dijit/Dojo 上下文菜单不显示子菜单
dijit/Dojo Context Menu Not Showing SubMenu
所以基本上我是一个新手,当涉及到 dojo 时才第二天使用它,但我尝试了所有方法但似乎无法让这个子菜单工作,基本上我所拥有的是我的 dgrid 列标题的上下文菜单可以工作很好,除了子菜单不会显示,我遇到的第二个问题是上下文菜单不会在鼠标处打开,而是在网页或应用程序的底部打开,任何 body 有什么想法吗?
here is a live version of the application
var activeMenuItem;
grid.on('.dgrid-column-goals:contextmenu', function(evt) {
evt.preventDefault();
});
require([
"dijit/Menu",
"dijit/MenuItem",
"dijit/CheckedMenuItem",
"dijit/MenuSeparator",
"dijit/PopupMenuItem",
"dojo/domReady!"
], 函数(菜单, MenuItem, CheckedMenuItem, MenuSeparator, PopupMenuItem){
var menu = new Menu({
targetNodeIds: [grid.domNode],
selector: ".dgrid-column-goals"
});
menu.addChild(new MenuItem({
label: "Hide Column",
onClick: function() {grid.styleColumn("goals", "display: none;");} }
));
var submenu = new Menu({
label: "Alignment"
});
submenu.addChild(new MenuItem({
label: "Alignment-Right",
onClick: function() {grid.styleColumn("number", "text-align:right");} }
));
});
已通过添加以下内容进行修复 css,以防有人遇到同样的问题。
.dijitPopup {
position: absolute;
}
所以基本上我是一个新手,当涉及到 dojo 时才第二天使用它,但我尝试了所有方法但似乎无法让这个子菜单工作,基本上我所拥有的是我的 dgrid 列标题的上下文菜单可以工作很好,除了子菜单不会显示,我遇到的第二个问题是上下文菜单不会在鼠标处打开,而是在网页或应用程序的底部打开,任何 body 有什么想法吗?
here is a live version of the application
var activeMenuItem;
grid.on('.dgrid-column-goals:contextmenu', function(evt) {
evt.preventDefault();
});
require([
"dijit/Menu",
"dijit/MenuItem",
"dijit/CheckedMenuItem",
"dijit/MenuSeparator",
"dijit/PopupMenuItem",
"dojo/domReady!"
], 函数(菜单, MenuItem, CheckedMenuItem, MenuSeparator, PopupMenuItem){
var menu = new Menu({
targetNodeIds: [grid.domNode],
selector: ".dgrid-column-goals"
});
menu.addChild(new MenuItem({
label: "Hide Column",
onClick: function() {grid.styleColumn("goals", "display: none;");} }
));
var submenu = new Menu({
label: "Alignment"
});
submenu.addChild(new MenuItem({
label: "Alignment-Right",
onClick: function() {grid.styleColumn("number", "text-align:right");} }
));
});
已通过添加以下内容进行修复 css,以防有人遇到同样的问题。
.dijitPopup {
position: absolute;
}