Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by tanith on Jun 23, 2009 09:25
open dhtmlx forum
FilterBy reset

Sorry about another topic on this subject, but no proposed solution works in my case...

I have a grid with 4 columns, and 4 input text which used to filter the grid. On a button i lauch a research which apply input text in filter :

function resetFilters()
{
    //clear filtering buffers
    monTableau._srowsCol=monTableau._srowsBuf=monTableau._f_rowsBuffer=null;
    for(i=1;i<5;i++)
    {
        monTableau.filterBy(i,"");
    }
}

function lancerRecherche() {//launch the research by filter
resetFilters();
monTableau.filterBy(1,Ext.getCmp('Trad___codeRech').getValue(),true);
monTableau.filterBy(2,Ext.getCmp('Trad___libelleFrRech').getValue(),true);
monTableau.filterBy(3,Ext.getCmp('Trad___libelleEnRech').getValue(),true);
monTableau.filterBy(4,Ext.getCmp('Trad___libelleSelecRech').getValue(),true);
monTableau.refreshFilters();
}

The filters works, but if I change values in the inputs, the data are filtered on the formal filtered list.

Reset the filter should make original data display back, isn't it ?...Not for, or my reset method is wrong.

NB : monTableau.filters.size always equals 0;

Thanks for reading


Answer posted by dhxSupport on Jun 24, 2009 03:56
In the grid column indexes start form 0. In the code   for(i=1;i<5;i++) you are clearing firters starts form the second column. Try to change that code to the following:
 for(var i=0;i<monTableau.getColumnsNum();i++) 
  { 
  monTableau.filterBy(i,""); 
  monTableau.getFilterElement(i).value="";//since dhtmlxGrid ver. 2.1
  }


In that cans you should clear filtering buffer. It will be cleared automatically. 
Answer posted on Jun 24, 2009 04:19
I work on thousand data, i've prefered the server-side's filter solution. Even if your solution would worked the javascript performence would be too worst

Thanks for answering