PDA

View Full Version : Grid store filtering very slow with multiple grids at the same time



craig2005
3 Jul 2012, 9:28 PM
The code below is brutally slow. I did a timeline in chrome developer tools and noticed it does tons recalculations for style and layout. Is there a way to pause this till the end and have it just layout everything at once? There must be a better way to do this without locking up the page.

I've got about 14 small grids on the page. This method takes about 4-8 seconds. It's the store filtering that is causing the recalculations and layouts on the grids and it seems to be freezing the browser till its done.

The component query and iterating through the grids is fast. I just need a way to do all the layouts at once.

What's also odd, is that the wait window never appears. It's almost as if the JS engine knows it's got a lot of work to do :-)



var filterGridsByVal= function (val) {
// get all grids
Ext.Msg.wait("Loading by: " + val, "Please Wait...");
var grids = Ext.ComponentQuery.query("gridpanel");
Ext.each(grids, function (grid, index) {
grid.store.clearFilter();
grid.store.filter("Col", val);
});
Ext.Msg.close();


};

evant
3 Jul 2012, 9:36 PM
If you're using 4.1.x,



var filterGridsByVal= function (val) {
// get all grids
Ext.Msg.wait("Loading by: " + val, "Please Wait...");
var grids = Ext.ComponentQuery.query("gridpanel");
Ext.suspendLayouts();
Ext.each(grids, function (grid, index) {
grid.store.clearFilter();
grid.store.filter("Col", val);
});
Ext.resumeLayouts(true);
Ext.Msg.close();


};

craig2005
4 Jul 2012, 3:45 PM
Awesome, thanks! I figured ext js had something like this. Thanks again!

taavih
30 Jul 2012, 12:06 AM
Whoaa!

That's helped to solve our biggest problem migrating from 4.0 to 4.1!

Cheers!