DHTMLX Docs & Samples Explorer

Filtering

dhtmlxcombo can work in filtering mode. In this mode the values in the list are filtered by current text entered in edit control. To enable filtration the next command should be called:

  z.enableFilteringMode(true);

By default, combobox uses options which have been already loaded in it, but it is possible to define the external script which will be called for generating list of suggestions.

  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 the described situation, once text in edit control is changed, the next url will be called php/complete.php?pos=0&mask=TEXT

  • TEXT - current text in edit control

The combobox awaits that script response will be an XML file in the same format which was used for initialization. If you prefer, you can return only part of suggestion, combobox can automatically send additional request and add more data to the list of options.

  z.enableFilteringMode(true,"php/complete.php",cache,true);

The server side script will be called by url php/complete.php?pos=START&mask=TEXT

  • START - position from which a suggestion must be returned.

For all additional sub fetches returned XML must have “add” attribute of the main tag:

  <?xml version="1.0" ?>
  <complete add="true">
  ...