PDA

View Full Version : Grid won't stop autorefresh



iceberg
29 Oct 2007, 1:26 PM
hi,

i built a grid that autorefreshes its data every n minutes
this is the code how i did it (i used code that was found in the forum)


Ext.override(Ext.data.Store, {
startAutoRefresh : function(interval, params, callback, refreshNow){
if(refreshNow){
this.load({params:params, callback:callback});
}
if(this.autoRefreshProcId){
clearInterval(this.autoRefreshProcId);
}
this.autoRefreshProcId = setInterval(this.load.createDelegate(this, [{params:params, callback:callback}]), interval*1000);
}
});



the grid refreshes nicely

the problem starts when i switch to another page (that doesn't even have a grid) i can see in firebug that the grid's data fetching continues to be called.

if i go to a page with another grid, now i get that both of the grids autorefresh and it continues even if i leave the page

i tried to add at the main page the following code


Ext.enableGarbageCollector=true;
Ext.enableListenerCollection=true;


it doesn't seem to work.

any ideas how to solve it ??????

Animal
29 Oct 2007, 2:54 PM
WHen you say "switch to another page", what does that mean?

iceberg
29 Oct 2007, 3:46 PM
i use the following code


function chngF(f)
{
var cpp=Ext.get('content');
var sUrl=f;
cpp.load({url: sUrl, text: "טעינת תוכנה מתבצעת...", nocache: false, scripts:true });
}