PDA

View Full Version : Message Bus in EXT JS 4 - Data not getting deleted from the bus once its received



Arpitha Nadig
4 Jan 2012, 4:38 AM
Hi All,
I am facing a problem in stimulating a message bus(event bus) in Ext JS 4.The data which I am sending from a component to the bus should be deleted from the bus once some event of another component listens to it or rather the data has been received by another component. This is not the case with my code. As I send newer data(or the same data again and again) to the bus , the older data still exists in the bus!!!Here is my code.
Ext.define('Ext.ux.MessageBroker', {
extend: 'Ext.util.Observable',

statics: {
sendMessage: function(data) {
this.fireEvent('sendData',data);
}
},

constructor: function(config){
this.addEvents({
"sendData" : true
});
}

});
// Sending a message:
Ext.ux.MessageBroker.sendMessage({"name":"ARPITHA"});

// Recieving a message:
Ext.util.Observable.observe(Ext.ux.MessageBroker);
Ext.ux.MessageBroker.on('sendData', function(data) {
console.log('Data...: ',data); // displaying the output here!
});

If these methods are called first time in my application,output is as follows:
Data...: Object { name="ARPITHA"}
When second time its invoked , output is
Data...: Object { name="ARPITHA"}
Data...: Object { name="ARPITHA"}

I hope my explanation is clear. Please let me know how to get rid of this . Thanks in advance.

Cheers,
Arpitha Nadig.

mitchellsimoens
4 Jan 2012, 7:40 AM
You will need to get with the author of Ext.ux.MessageBroker to resolve your issue with the extension.

Arpitha Nadig
4 Jan 2012, 10:14 PM
A little idea from anybody who has faced similar issue would be very much helpful . Hoping to get a reply! Need to solve this problem.