CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Multiple AutoComplete

by zsleo » 05 Dec 2013 15:00

Thanks for your help.

I have implemented OnGetAutoCompleteData and it is triggering correctly but my data grid is not updating with data. I gave tried reload grid and ajax rerender but neither work.

The dataset is returning the data as expected. Please remember I do not have a data link on any of the auto complete components. I construct the SQL based you many user selected options

TIA
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

by Jorge Sousa » 05 Dec 2013 15:51

Hi Leo

Like the grid provider events

the autocomplete OnGetAutoCompleteData (and also in dropdown)

They don't support ajax response, it's just for data, nothing else, there is no javascript code to process ajax response.

You have to do this:

I gave tried reload grid and ajax rerender but neither work


use an AutoComplete event, like OnChange.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by zsleo » 06 Dec 2013 01:50

The Final Result thanks to CGD support.

Hope this will be helpful to others.

Scenario: I need multiple auto-search components is a dialog to operate on the same DB table. There are approx 2 million records in table.

There is a data grid that displays the retrieved data.

I placed 4 AutoComplete components in a dialog.

None of the AutoComplete components are connected to the database (i.e. no DataLink)

Each AutoComplete has a OnGetAutoCompleteDataEx event similar to as follows:
Code: Select all
procedure TiwfrmMain.iwcgjqtcmpltSurnameGetAutoCompleteDataEx(Sender: TObject; const ATerm: string; AData: TStrings);
begin
  gv_Surname := ATerm;
  DoSearch; // Call the procedure to perform the data retreival
end;


All AutoComplete components are linked to the same Event JQAutoCompleteOptions OnSearch

Code: Select all
procedure TiwfrmMain.iwcgjqtcmpltSurnameJQAutoCompleteOptionsSearch(Sender: TObject; AParams: TStringList);
begin
  iwcgjqgrdResultGrid.JQGridOptions.ReloadGrid;
end;


Works really well and fast.

Regards,
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

by George » 06 Dec 2013 16:08

delphi code
DoSearch; // Call the procedure to perform the data retreival

You pass filter parameters as SQL parameters? Then DBMS executes your query with filled sql variables?

Something like that?
delphi code
ADQ.Active := False;
ADQ.Params.ClearValues();
ADQ.ParamByName('UserID').AsGUID := StringToGUID(UserID);
ADQ.ParamByName('LNG').AsString := lng;
ADQ.ParamByName('ShowOpened').AsBoolean := Filter.ShowOpened;
ADQ.ParamByName('ShowClosed').AsBoolean := Filter.ShowClosed;
if not Filter.SolutionID.IsEmpty then
ADQ.ParamByName('SolutionID').AsGUID := StringToGUID(Filter.SolutionID);
if not Filter.RequestTypeID.IsEmpty then
ADQ.ParamByName('RequestTypeID').AsGUID := StringToGUID(Filter.RequestTypeID);
if not Filter.SearchString.IsEmpty then
ADQ.ParamByName('SearchString').AsString := Filter.SearchString;
ADQ.Open();

(Each filter request processed in sql server to reduce CPU load on web server).
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

Previous

Return to JQAutoComplete

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.