Refreshing old queries in smart rendering

I am using the dhtmlxgrid to display the results of a structured search. For example, a user chooses items from a dropdown, which causes the dhtmlxgrid below to update with the results of the search. As more dropdowns values are specified, the search narrows down to a smaller set. The original set of items is very large (> 200,000).

I also have a ‘reset’ button that is intended to clear the dhtmlxgrid.

I have a script which fetches data from the backend database at 150 rows per query. I am using “results_grid.load(url, ‘xml’)” with a custom built url to call the script.

I call “results_grid.enableSmartRendering(true, 150)” to enable smart rendering so that the application remains responsive while gathering data.

Now, as a user narrows down his search, the dhtmlxgrid attempts to gather more results from stale queries. They get appended to the rows in the table.

Is there any way to reset the dhtmlxgrid so that it doesn’t behave this way?

You can delete all already loaded rows ( and reset awaited rows count ) by using
grid.clearAll(); //delete currently loaded rows
grid.loadXML(new_one); //start new data loading

The specified approach didn’t work. When I used ‘clearAll’ followed by ‘loadXML’, a new query result is loaded into the grid. In the background requests continue to be sent for stale query results (with a row-count that applies to the new query).

I’ve attached my code file. The relevant code is on line 197. (2.19 KB)