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





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.

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