Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by María Jose on Oct 29, 2008 06:56
open dhtmlx forum
Combobox filtering process

I have a problem with the combohtml with filtering usind this:
z.enableFilteringMode(true,"php/complete.php",true);
I need to change the filtering process. While the user are writing in the combo I don´t want to do filtering, when the user finish it´s the moment i want to filter to find results. This is because I used this combo for controling names of person and the number of record are very hight and this process is too slowly.
Thanks you
María José
Answer posted by Support on Oct 29, 2008 07:14
dhtmlxcombo.js, line 667
     

Can be changed with 
if (this._filter) {
    var self = this;
    if (this._timer) window.clearTimeout(this._timer);
    this._timer = window.setTimeout(function(){
             self.filterSelf((ev==8)||(ev==46));
    },500);
}

with such code, filtering will start only after user stop typing. 
Answer posted by Maria Jose on Oct 30, 2008 02:39
Thanks again for your quicky answer. I found your code very useful for my problem. But I have another problem. It´s possible that only filter using the complete word when I finish the typing?. In my case, (when I complete the word in the combo) the filtering process try to find all the pieces that compose the word.
Maria Jose
Answer posted by Support on Oct 30, 2008 03:50
If you are using sever side filtering - it fully depends on server side code, component only sends mask to the server and server side code controls how search done. 
If you are using client side filtering - the search regexp defined at line 980 as
         var filter=new RegExp("^"+text,"i"); 
and can be adjusted in any necessary way. 

Answer posted by María José on Oct 30, 2008 05:59
I used a code very similar of the sample filtering 100.000 with mask, but I don´t know the way of filtering all the word.
It´s possible I appreciate if you could give me a solution for my problem. Thank you for your help.
Answer posted by Support on Oct 30, 2008 08:59
In "100000" sample, loadCombo.php, next line selects options
 function getDataFromDB($mask){
        $sql = "SELECT DISTINCT item_nm FROM RandomWords Where item_nm like '".mysql_real_escape_string($mask)."%'";

"where" clause defines rules how list of options will be created.