umr.ashrf
4 Sep 2012, 6:35 AM
I have a view and a controller. The view has menu under button of which items when clicked will be handled by controller. The event is never caught by controller if I put class selector but it works if I remove class selector.
Have a look at my code.
Ext.create('Ext.Button', {
text: 'Add Tab',
cls: 'button',
menu: Ext.create('Ext.menu.Menu', {
cls: 'addMenu',
items: [{
text: 'One'
}, {
text: 'Two'
}]
})
});
Ext.define('MyApp.controller.TabController', {
extend : 'Ext.app.Controller',
init : function() {
this.control({
'menu[cls=addMenu]' : {
'click' : this.addTab
}
});
},
addTab : function(a, b, c, d) {
console.log(a, b, c, d);
}
});
What am I doing wrong here?
Have a look at my code.
Ext.create('Ext.Button', {
text: 'Add Tab',
cls: 'button',
menu: Ext.create('Ext.menu.Menu', {
cls: 'addMenu',
items: [{
text: 'One'
}, {
text: 'Two'
}]
})
});
Ext.define('MyApp.controller.TabController', {
extend : 'Ext.app.Controller',
init : function() {
this.control({
'menu[cls=addMenu]' : {
'click' : this.addTab
}
});
},
addTab : function(a, b, c, d) {
console.log(a, b, c, d);
}
});
What am I doing wrong here?