Resetting filters only working partially

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

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

Hey sematik,

thanks for your answer. mygrid._f_rowsBuffer is always null, so your solution does not work. Don’t know why.
I then compared the whole grid objects before any sorting and after sorting and resetting and found the problematic entry.

delete mygrid._connector_filter; does the job. :slight_smile:

Hope it helps other guys with similar issues.

Greetings
Peter