Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Daniel on Apr 08, 2008 21:10
open dhtmlx forum
XCombo with filtering mode - controlled delay

Hi. I am using XCombo with filtering mode enabled. Currently, the xCombo fires an http request each time a character gets typed ion the box. Can we have a controlled delay time before xCombo fires its http request?

The problem I am having is that the user can type faster than the http request issued by the xCombo. Each http request goes to the database, executes a SQL command, gets the options, put them in XML formatted string, sends it back to teh xCombo. This is a slow process to catch up
Say the user is trying to type "Philip Jordan", he types "P" and a list comes back with all options that start with "P", then when he types "h" a list comes back with all options start with "Ph", so on so. But what we need to do is to wait until the user finishes typing and - say half a second later - before the http request gets fired.

Is this possible?

Regards,
Daniel
Answer posted by Support on Apr 09, 2008 05:22
Can be done with small code modifications

dhtmlxcombo.js , line 938

        if (this._load) this._load=url;
        else this.loadXML(url);

Can be changed as

        if (this._load) this._load=url;
        else {
           var that=this;
           if (this._timeout) window.clearTimeout(this._timeout);
           this._timeout=window.setTimeout(function(){
                that.loadXML(url);
            },500);
         }