PDA

View Full Version : How to make toolbar items clickable when set to defaultType of 'menuitem'?



wood_tah
1 Mar 2013, 4:08 AM
I was wondering what I might be missing when I make the defaultType of the toolbar I create 'menuitem'. It displays nicely, but the items are not clickable, and do not act as links/buttons. Am I missing a config, or do I need to do extra work when you override the defaultType value from its normal 'button' value?

Below is a snippet of my code:



init: function() {
var me = this;
var myItems = [
{
text: 'First',
itemId: 'id-1',
listeners: {
click: function(btn, evt, opts) {
// do some logic
},
scope: me
}
},
{
text: 'Second',
itemId: 'id-2',
listeners: {
click: function(btn, evt, opts) {
// do some logic
},
scope: me
}
}
];

me.cmp.addDocked({
xtype: 'toolbar',
dock: 'left',
enableOverflow: true,
padding: 5,
resizable: true,
defaultType: 'menuitem',
items: myItems
});
}


Any help is greatly appreciated.

Thanks.

mitchellsimoens
4 Mar 2013, 8:16 AM
menuitem is not meant to be displayed within a toolbar. Why not just style the button?

wood_tah
12 Mar 2013, 6:47 PM
Thanks for the clarification. I was trying to cheat a little ... now will need to try and style the buttons to look like menuitems.