-
1 Mar 2008 4:19 AM #1
Disabling grid when reloading datasource
Disabling grid when reloading datasource
When someone clicks the next or previous or when the grid initially loads, the grid shows a load mask and the grid is disabled. But when i do a datasource.reload() in the loadexception event the loadMask appears for a few seconds and disappears even before the data is returned. Is there a way to keep the load mask active till the data is refreshed when doing a reload too?
i have the listeners for the Store setup as something like this
Code:listeners: { beforeload: function(store, options){ store.removeAll(); if(retry == 0) { grid.loadMask.msg = "Loading..."; } else if(retry <= totalRetries) { grid.loadMask.msg = "Retrying (" + (retry+1)+ ")..."; } else { retry = 0; grid.loadMask.msg = "Loading..."; } }, load: function() { retry = 0; }, loadexception: function(proxy, store, response, e) { retry++; if(retry <= totalRetries){ ds.reload(); grid.reconfigure(grid.getDataSource(), grid.getColumnModel()); } } }
-
1 Mar 2008 11:38 AM #2
What is it for?Code:grid.reconfigure(grid.getDataSource(), grid.getColumnModel());
Use the force - read the source.
My ExtJS extensions can be found here: http://max-bazhenov.com/dev/
-
2 Mar 2008 3:30 AM #3
that was just something i tried to see if it would bring up the load mask, i forgot to remove it
-
2 Mar 2008 5:31 AM #4
Try to defer the reload call like
Code:ds.reload.defer(100, ds);
Use the force - read the source.
My ExtJS extensions can be found here: http://max-bazhenov.com/dev/
-
2 Mar 2008 7:43 AM #5
Thanks a ton!! that worked! I still don't understand what ds.reload.defer(100, ds) did though, since if reload was deferred how did the load mask appear even without calling the reload?
-
2 Mar 2008 8:43 AM #6
Means "please Ext wait 100 ms and call the ds.reload method in context of ds object".Code:ds.reload.defer(100, ds);
So the sequence is:
1. call before load listeners
2. show load mask
3. do the Ajax request
4. exception occured
5. call load exception listeners -> defer reload
6. hide load mask
7. defered reload
8. goto 1Use the force - read the source.
My ExtJS extensions can be found here: http://max-bazhenov.com/dev/
-
2 Mar 2008 7:39 PM #7


Reply With Quote