PDA

View Full Version : How to load the store of a grid when the grid is rendered



cblin
8 Nov 2010, 1:43 AM
I am trying to launch the loading of the store when a grid is rendered.

I obviously tried this :


listeners: {
render: function(grid) {grid.store.load()}
}


this does not work for the first rendering

this is because the loadMask of a GridPanel is initialized in the initEvents method BUT the initEvents method is called in the afterRtender method which is called after the render event has been fired by the onRender method...

Then I tried to override the afterRender method :


afterRender : function(){
Ext.easy.GridWithFilter.superclass.afterRender.call(this);
this.store.load();
},


This almost works but the loading message is not centered.

Any help appreciated.

cblin
8 Nov 2010, 1:45 AM
I find my answer : use store.load.defer(200, store)

this way, all the extjs stuff has correctly been executed