Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Ivan S on Mar 13, 2008 23:37
open dhtmlx forum
ComboBox dynamic filtering

Hi,

In http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=recent&q=2237 you mention that is NOT possible to filter results when obtaining them dynamically from a server side script.
While in the documentation is stated at the Filtering section, I quote:

"By default combobox uses options which already loaded in it, but it is possible to define the external script which will be called for generating list of suggestion.
            z.enableFilteringMode(true,"php/complete.php",cache);
        
php/complete.php - path to script
cache - true/false - enable/disable caching of script responses ( using "true" recommended )
In described situation, for each change of text in edit control the next url will be called
php/complete.php?pos=0&mask=TEXT
TEXT - current text in edit control ..."
Meaning that everytime user types something, the server script will be called with different parameters.
by the way, Whats the "described situation" here?

Also, I would like to know what are the functions to obtain a behavior like the one on the sample "100,00 words", where there is supposedly a MySQL database with a bunch of words and the combobox is being filtered/querying the DB, as the user types something.

Thanks, hope you can answer me
Ivan Sifuentes
Answer posted by Support on Mar 14, 2008 07:23
>>In http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=recent&q=2237 you mention that is NOT possible
The mentioned post states that only one mode of filtering - client side or server side - can be used

>>by the way, Whats the "described situation" here?
Initialization of combo with enableFilteringMode(true,url); command

>>Also, I would like to know what are the functions to obtain a behavior like the one on the sample "100,00 words",
>>where there is supposedly a MySQL database with a bunch of words and the combobox is being filtered/querying the DB, as the user types something.

Combobox support two different filtering mode

a) fully client side, enabled by combo.enableFilteringMode(true)
In such mode combo filters only data which added into combo by addOption or loadXML commands, it doesn't use server side scripts for fetching additional data

b) fully server side, enabled by combo.enableFilteringMode(true,url)
In such mode, each time when text in combo changed , new request send to server and combo shows list of options fetched from server ( it is expected that fetched options will start from current text in combo, which send to server as one of request parameters )

The post at http://www.dhtmlx.com/docs/products/kb/index.shtml?cat=recent&q=2237  contains logic which tries to relay on both client and server side sorting , which is not possible, the code in this thread uses server side filtering but returns static list of data  ( same as in case of client side filtering ) , solution provides in mentioned thread recommend to use client side filtering but it can be codded as server side filtering as well ( just requre some server side code modification )