Reloading, Filtering and maintaining filter...possible bug?

Hi,

I am trying to reload data into an existing grid after saving a form or just periodic reloading, but want to keep the current filters effective.

I figured out that calling filterByAll() works, however I’m having trouble with doing that automatically…

If I call

myGrid.clearAll();
myGrid.load(‘myurl…’,myGrid.filterByAll(),‘json’);

it doesnt work,

myGrid.clearAndLoad(‘myurl’,‘json’);
myGrid.filterByAll();

also fails…

myGrid.clearAndLoad(‘myurl’,myGrid.filterByAll(),‘json’);
myGrid.filterByAll();

also fails…

			contactsGrid.clearAndLoad('http://myapiurl/json',AplicaFiltros(),'json');
	function AplicaFiltros(){
		setTimeout("contactsGrid.filterByAll()",500);
	}

works, but I suspect it is network speed dependent… I suspect clearAndLoad and Load are calling the callback function BEFORE finishing loading the data (not after finishing as per documentation)? Is there any way to check for the response to ensure that it is indeed complete? like on XHR requests?

thanks

You should wait till all rows are loaded:

myGrid.clearAll(); myGrid.load('myurl.....',function(){ myGrid.filterByAll() },'json');

or

myGrid.clearAll(); myGrid.load('myurl.....',doOnLoad,'json'); function doOnLoad(){ myGrid.filterByAll() }