2

クリックするとメニューが表示されるツールバーボタンがあります。自動にしたいです。つまり、マウス ホバー時のドロップダウン メニューです。私は次のコードでこれを行いました:

xtype : 'button',
                text : 'My Button',
                listeners : {
                    mouseover : function() {
                        console.log('inside mouse over');
                        this.showMenu();
                    },
                    menushow : function() {
                        console.log('menu shown');
                        this.mouseLeaveMonitor = this.menu.el
                                .monitorMouseLeave(100, this.hideMenu, this);
                    },
                    destroy : function(combo) {
                        combo.menu.el.un(combo.mouseLeaveMonitor);
                    }
                },
                menu : [{
                            text : 'menu item1'
                        }, {
                            text : 'menu item2', menu : [{text : 'text 1'}, {text : 'text 2'}]
                        }]

さて、私のコードはドロップダウン メニューでは正常に動作しますが、サブメニューでは失敗します。誰でもこれについて助けることができますか?

4

2 に答える 2

0

I think this person was trying to accomplish the same thing as you: ExtJS 4.1 "HoverButton" extension issue

The difference you will need to add is to have your menu configured as an object config, not as an array of items:

{
    xtype: 'hoverButton',
    text : 'My Button',
    menu : {
        items: [{
            text : 'menu item1'
        }, {
            text : 'menu item2',
            menu : {
                items: [{text : 'text 1'}, {text : 'text 2'}]
            }
        }]
    }
}
于 2013-07-01T13:04:59.547 に答える