Resetting filters only working partially


#1

Hello there,

from anywhere inside this forum I got the following snippet to allow clearing all dhtmlxGrid filters:

dhtmlXGridObject.prototype.resetFilters = function(){
    if (!!this.filters){
        for(var i=0;i<this.filters.length;i++){
            if (!!this.filters[i][0]) {
                this.filters[i][0].old_value="";
                this.filters[i][0].value="";
            }
        }
        this.filterBy(0,"");
    }
};

I then call: mygrid.resetFilters();.
This works as intended on first sight.

When I perform a sorting after it (sorting type is connector), it performs the sorting and respects the old, cleared filters, although they are not visibly in the table header.

It seems, there are more internally stored variables that reapply in some situations. Maybe it’s a connector-specific thing?

Can you please tell me, how to reset filters even for connector-based grids?

Thanks in advance,
Peter


#2

PLeas,e try to aslo to add the:

mygrid.filterBy(0,"");
mygrid._f_rowsBuffer = null; //add this line

https://docs.dhtmlx.com/grid__filtering.html#addingdeletingrowsinthefilteredgrid