PDA

View Full Version : Grid listener to loaded and showed data?



daniferi
3 Mar 2011, 10:34 AM
I made a grid and I want use 'manual' masking while loading data.


var dataStore = new Ext.data.Store({
proxy:proxy,
reader:reader
});
var grid = new Ext.grid.GridPanel({
...
listeners: {
render: function() {
this.el.mask('Loading data, please wait...');
dataStore.load();
}
},
...
})


Masking is working: when ext window and its grid showed the mask is "turning on" and loading data. But what is the listener of loaded data? Or how can I unmask this when loaded data is shown in grid?

raj_plays
4 Mar 2011, 12:17 AM
You should remove the mask on the 'load' event of the grid's store. It gets called after data has been loaded.
grid.getStore().on('load', function()
{
//unmask here
});

daniferi
4 Mar 2011, 9:57 AM
I found another way to my original problem: I wanted to custom mask.
Here is the solution:


gridCreate: function(){
var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Loading data, please wait..."});
var grid = new Ext.grid.GridPanel({
store: dataStore,
loadMask: myMask,
listeners: {
viewready: function(){
this.store.load();
}
},
...
}
}

I don't know why but when I used "render" listener, the loadmask was not shown and the "afterlayout" listener was loaded data 5 times and made it again later every "dolayout".