I have a combo box . This listens to 'select' event. I trigger a custom event in the select event callback. This event is being fired twice when ever there is a change.
I have a similar combo box connected to the same controller but only one event gets fired from it.
I am using ExtJs 5.
Here is my code.
{
xtype: 'combobox',
width: 150,
textAlign: 'left',
store: {
fields: ['text', 'value'],
data: [
{"text": "a", "value": "a"},
{"text": "b", "value": "b"},
]
},
allowBlank: false,
editable: false,
displayField: 'text',
valueField: 'value',
listeners: {
select: function (combo, records) {
console.log('comboooo ---------------- ', records[0].data.value);
this.fireEvent('custom-event', 'key', records[0].data.value);
},
afterrender: function (cmp) {
cmp.setSelection(1);
}
}
}
Edit : Here is what it is going in my application.
I have a MainViewcontroller , MainView and SubView . SubView is a component inside the MainView.
I have two components each in SubView and MainView. I am adding the SubView after the MainView is added.
I am firing a custom event from 'change' event of a component of MainView. The MainController is able to recognize this. This event occurred only once as expected.
Now when i fire the same custom event from 'change' event of a component of SubView this event is getting fired twice