PDA

View Full Version : about store's on load event



pirusira
10 Jun 2010, 4:44 PM
Hello all :)

I have a store and when I click a button, the store is loaded and then the 'on load' event is supposed to occur.
But the 'on load' event isn't occured.

The following is my code.


//the json store
var groupDataStore = new Ext.data.JsonStore({
url: 'GroupDataCollector.action',
root: 'groupInfo',
idProperty: 'groupCode',
totalProperty: 'groupTotal',
fields: [
'groupCode',
'name'
],
remoteSort: true,
sortInfo: { field: "groupCode", direction: "ASC" }
});

//the store's event
groupDataStore.on('load', function(store, records, options) {
alert("loaded.");
});

//a paging toolbar that has a button to occur the event.
deviceListBbar = new Ext.PagingToolbar({
id: 'deviceListBbar',
pageSize: myPageSize,
store: store,
displayInfo: true,
displayMsg: '{0} - {1} {2}',
emptyMsg: "no data",
items:[
'-',
{
pressed: false,
text: '????',
iconCls: 'printer_add',
listeners: {
render: function(button){
button.getEl().on('click', function(){
groupDataStore.load();
});
}
}
}
]
})


When I click the button, the store is loaded well, but the store's on load event isn't occured.(the alert doesn't work)
Let me know what the problem is with that code.

Thanks in advance.
Stan