dhtmlxCombo - visually show filtering

Hi,
I have a page that dinamically filter a combo:

var z = new dhtmlXCombo(‘id_lugar’, ‘id_lugar’, 200);
z.enableFilteringMode(true, ‘get_xml.php’, true);

sometime the connection with the server is slow, so how can I:

  • call the page “get_xml.php” only when the user is not writing anything, for example if I have no keyboard input after 300ms?
  • show a “loading icon” while loading data, is there a way to use events like “onFilterStart” and “onFilterEnd”?

thank you!

Hi,

all the page “get_xml.php” only when the user is not writing anything, for example if I have no keyboard input after 300ms?

You can redefine filterSelf (private method that executes filtering functionality) and make it called with 300ms timeout:

var filterSelf = dhtmlXCombo.prototype.filterSelf; var timer; dhtmlXCombo.prototype.filterSelf = function(mode){ if(timer) window.clearTimeout(timer); var self = this; timer = window.setTimeout(function(){ filterSelf.call(self,mode); },300); }

show a “loading icon” while loading data, is there a way to use events like “onFilterStart” and “onFilterEnd”?

Combo provides onXLS and onXLE events that are called before and after xml loading. So, you may show an image when onXLS fired and hide it on onXLE.

combo.attachEvent(“onXLS”,showImage);
combo.attachEvent(“onXLE”,hideImage);

Perfect, thank you!