I have a menu
for a button, which in turn is set as the tools
for a container. I want to handle click on the menu items and not on the button itself. How do I implement it?
Example, should be straight forward:
Ext.onReady(function() {
new Ext.panel.Panel({
renderTo: document.body,
title: 'A Panel',
width: 200,
height: 200,
tools: [{
xtype: 'button',
text: 'Foo',
menu: {
items: [{
text: 'Item 1',
handler: function() {
console.log('Item 1');
}
}, {
text: 'Item 2',
handler: function() {
console.log('Item 2');
}
}]
}
}]
});
});