2016-05-17 152 views
0

我想水平顯示PopupMenuItem,但無法找到執行此操作的方法。水平顯示PopupMenuItem

我加入像這樣

var pSubMenu2 = new Menu(); 
    pSubMenu2.addChild(new MenuItem({ 
    iconClass: "dijitEditorIcon dijitEditorIconCopy" 
    })); 
    pSubMenu2.addChild(new MenuItem({ 
    iconClass: "dijitEditorIcon dijitEditorIconCut" 

    })); 
    pMenu.addChild(new PopupMenuItem({ 
    iconClass: "dijitEditorIcon dijitEditorIconPaste", 
    popup: pSubMenu2 
    })); 
下面

是代碼

https://jsfiddle.net/agha_ali22/ntkhy9q3/2/ 

回答

1

你可以做以下的鏈接:

pSubMenu.addChild(new MenuItem({ 
     iconClass: "dijitEditorIcon dijitEditorIconCopy", 
     style: "display:inline" 
    })); 
    pSubMenu.addChild(new MenuItem({ 
     iconClass: "dijitEditorIcon dijitEditorIconCut", 
     style: "display:inline" 
    })); 

添加display:inline到每個子菜單的孩子,你想要水平顯示。

看一看這裏:http://jsfiddle.net/an90dr/27uo0hpo/

+0

還有一個問題,我怎麼能隱藏unhover子菜單? – Haider

+0

您可以將pSubMenu添加到小部件的作用域中,例如:this.pSubMenu。然後,您可以在mouseleave上添加一個事件並關閉彈出窗口。你可以看到下面的例子:https://jsfiddle.net/an90dr/27uo0hpo/ – AndreasH

+0

即使將其懸停在其父菜單上,該隱藏子菜單並不再顯示 – Haider