How to bubble events from Store (revisited)
Hello everyone. I tried to do some research on how to bubble an event from the Store and I came across this thread from the EstJS 4 forum - http://www.sencha.com/forum/showthre...Ext.data.Store
With that, I tried to see if I can accomplish this in 3.2.1 and what I would to accomplish is to be able to bubble an event from the store after the records have been loaded.
Here, I have extended the store with the event I need to fire after the records have been loaded.
Code:
// Extension of the Store
Ext.ux.GridAwareStore = Ext.extend
(
Ext.data.Store,
{
constructor: function(config){
Ext.ux.GridAwareStore.superclass.constructor.apply(this, arguments);
this.addEvents('actioncomplete');
this.reader.readRecords = this.reader.readRecords.createSequence(this.verifyResponse, this);
},
verifyResponse: function(o){
console.log('got the load');
this.fireEvent('actioncomplete');
},
loadData : function(o, append){
this.fireEvent('actioncomplete', this);
},
listeners: {
storeloaded: function(r) {
this.enableBubble('actioncomplete');
}
}
}
);
The issue on the Grid is that I am able to capture the event being fired from the Store only once (initial loading). After that, this section of code is never reached.
Code:
// GridPanel overridden
Ext.override(Ext.grid.GridPanel, {
bubbleEvents: ['actioncomplete'],
initComponent: Ext.grid.GridPanel.prototype.initComponent.createSequence(function() {
this.addListener('actioncomplete', function() {}, this);
console.log('the grid has it');
this.fireEvent('actioncomplete');
})
});
The questions I have are how does one maintain passing the Store's data while bubbling the event and why is my listener only capturing the event once.
Any help is greatly appreciated. Thank you.