grid makeFilter uses old data set

Here’s my problem. I’ve been able to reproduce it on two occasions, I can’t figure out exactly what’s wrong…



At first, I load my grid’s data using loadXML() and I use makeFilter to filter one of the columns by a text input (this works fine).



Then I have a select (combo box) that performs a server-side query to load a new data set into the grid (works fine too).



I use grid.clearAll and grid.loadXML to reload the grid’s data.



After the loadXML has been called, the data in my grid changes, but if I try to filter it at this point, it acts like it’s filtering on the previous dataset and not the one that’s been freshly loaded.



Is there a way to reset the filter as well? Is there something I am missing?



Thanks!



We cannot reproduce this issue locally. Could you please send us any kind of sample? What version of dhtmlxGrid do you use?

The mygrid is built from an XML file sent by the server.  It has 3 columns :  checkbox, user display name and user account name.
I am filtering on 2 things : group name (server side) and account name (which isn’t working properly).

function do_filter(group) {
   mygrid.clearAll();
   mygrid.loadXML(‘ACTION?mode=doFilter&groupFilter=’ + group + ‘&noCache=’ + (new Date()).valueOf());
}

do_filter is triggered by the onchange event of the combo box containing the groups, it’s working as intended.

This is the (faulty) account filter :


Let’s say I have group A with user John, Wayne and Nancy, group B with Bruno, Denis and Nancy again with group A as my default.

Step 1 - Only group A is loaded, if I do a search for Denis, the result grid is empty, if I erase the filter, I’ll get all 3 users back in the grid.
Step 2 - I select group B from the combobox, now, Bruno, Denis and Nancy are loaded into the grid.  There are no traces of group A in the XML that is loaded.
Step 3 - I type ‘W’ in the filter, Wayne (from group A) appears (how can this be?). if I type B, it doesn’t find Bruno…
Step 4 - I use backspace, now that the filter is empty, I see John, Wayne and Nancy (it reverted to group A!)

It’s really as though the filter doesn’t get reset and keeps searching on an old dataset.




Oh yeah I forgot, here’s what I’m using : dhtmlxGrid v.1.6 Professional edition build 80512


This bug was fixed at the latest version of dhtmlxGrid. You can update your files or add following code to the do_filter(group) function:


mygrid.clearAll();
//clear filtering buffers
mygrid._srowsCol=mygrid._srowsBuf=mygrid._f_rowsBuffer=null;



Thanks for the quick reply!