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?
You can handle all items in a listener through a code below. Pass a menu config to a button and add a click listener to the menu.
{
xtype: 'button',
text: 'Button',
menu: {
xtype: 'menu',
items: [
{ text: 'foo' },
{ text: 'bar' },
{ text: 'hoge' }
],
listeners: {
click: function( menu, item, e, eOpts ) {
console.log(item.text);
}
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With