PDA

View Full Version : How stop grid render until store load



genius551v
6 May 2010, 1:50 PM
Hello guys, i need help with this:

I need a grid, but i need send something, for example: a text for emptyMsg, from store load. the problem is: the grid reder and the store load asyncronus, so...in the moment to create the bbar pagingtoolbar, the store not load yet.

I think need a event o override something to STOP the render grid (or creation) UNTIL the store load...

some body can helpme ??? please!

Tnks

some code


MyGridPanel = function(config){
Ext.apply(this, config);

var store = new Ext.data.JsonStore({
proxy: new Ext.data.HttpProxy({url: config.url, method: 'POST'}),
autoDestroy: true,
remoteSort: true,
fields: []
});

MyGridPanel.superclass.constructor.call(this,{
columnLines: true,
stripeRows: true,
bufferResize: false,
trackMouseOver: true,
layoutConfig: {deferredRender: false},
selModel: new Ext.grid.RowSelectionModel(),
store: store,
columns: [],
viewConfig: {
onDataChange: function(){
this.cm.setConfig(this.ds.reader.jsonData.columns);
}
},
bbar: new Ext.PagingToolbar({
pageSize: 25,
store: store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: store.reader.jsondata.emptyMsg //<- send from (php) json, for EN = No topics to display , to ES = Nada para mostrar
})
});

var cpanel = Ext.getCmp(this.ownerCt.id);
cpanel.dataPanel = this.id;
};

Ext.extend(MyGridPanel, Ext.grid.EditorGridPanel, {
initComponent : Ext.grid.GridPanel.prototype.initComponent.createInterceptor(function (){
this.store.load();
this.store.on('load', function(){
?????????? something like that maybe to load params to grid from json before render???????

});

}),
initEvents: function(){
MyGridPanel.superclass.initEvents.call(this);
}

});

Ext.reg('MyGridPanel', MyGridPanel);

eugs51
6 May 2010, 6:42 PM
You can use Javascript Continuations, first load the store before instantiating the component.

genius551v
9 May 2010, 7:47 AM
:( but how? can u help me a little more please? tnks

Animal
9 May 2010, 7:55 AM
You don't need to stop it rendering. Rendering a grid is different from updating its rows.

It will update its rows on store load.