ExtJs泡泡菜单事件
我有我的ExtJs菜单定义如下。 我有两个自定义方法添加到我的菜单项'hookMethod'和'handlerMethod'。 'hookMethod'是根据一些条件添加的。 我将单个菜单项的点击事件提交到根菜单。 然后检查是否定义了钩子,然后调用'hookMethod',否则直接调用'handlerMethod'。 我面临的问题是点击侦听器被调用两次,一次用于menuitem,一次用于菜单。 另外,什么是电子争论。 我以为它只会被调用一次菜单,我将有一些方法来检索被点击的实际菜单项。
{
    xtype: "menu",
    listeners: {
        click: function(item, e, eopts)
        {
            if(item.hookMethod) { 
                item.hookMethod(item.handlerMethod);
            }
                else {
               item.handlerMethod(this);
            }
         }
    },
    items: [{
        xtype: "menuitem",
        text: "Process Record",
        bubbleEvents: ['click'],
        hookMethod: function(actualMethod)
        {
            //do some pre-processing here and then call the actual handler
            actualMethod(args)
        },
        handlerMethod: function(args)
        {
            //Do actual processing
        },
    }]
}
  Ext.menu.Menu click( menu, item, e, eOpts )事件有四个参数。 
  第一个参数是menu对象本身。 
  第二item参数是被点击的菜单项的对象。  您可以使用此参数确定单击菜单中的哪个项目。 
