PDA

View Full Version : Menu and MenuItem click dont work



Forn
1 Aug 2012, 2:26 AM
Hello.
I have the next code:


Ext.define('WebAdmin.view.global.TopPanel', {
extend: 'Ext.panel.Panel',
alias: 'widget.toppanel',

id: 'panelUserInfo',
region: 'north',
collapsible: false,
split: false,
height: 31,

dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [
{
text:'Меню',
menu: {
items: [
{
text: 'static',
handler: this.mnuStaticAdmin_click,
click: this.mnuStaticAdmin_click
}
]
}
}
]
}],



/**
* Ext.menu.Item item
* Ext.EventObject e
* Object eOpts
*/
mnuStaticAdmin_click: function(item, e, eOpts){
Ext.MessageBox.alert("test", "mnuStaticAdmin_click");
}

});


But mnuStaticAdmin_click don't invoke when i click the menu item =( What i do wrong?

sword-it
1 Aug 2012, 3:31 AM
Hi,

Problem is getting panel reference under docked item.Try this code


dockedItems: [{
xtype: 'toolbar',
dock: 'top',
items: [
{
text:'Меню',
menu: {
items: [
{
text: 'static',
handler: function(){
Ext.getCmp('panelUserInfo').mnuStaticAdmin_click();
}
}
]
}
}
]
}]


See the working Example - http://jsfiddle.net/erAQQ/

nhan
5 Dec 2012, 1:45 PM
In my controller, I did get the event with the item param. So I used item.text to compare with the item text which is working, but not good. I am thinking to check item index. How can I do that? Does event give anything?
Thanks for any help.