0

我在 jquery ui 对话框中放置了 dojo 下拉按钮。按钮的下拉列表不会显示在 jquery ui 对话框中,但会创建 dojo 按钮。我将 z-index 设置为超过 1000。你对这个问题有什么建议吗?

这是我的代码

  //links for dojo library
 <script type="text/javascript">


//beginning of TraderView(CDS) Actions Button

require(["dojo/ready", "dijit/form/DropDownButton", "dijit/DropDownMenu", "dijit/MenuItem", "dojo/dom"], function (ready, DropDownButton, DropDownMenu, MenuItem, dom) {
    ready(function () {

        //for document
        var menu = new DropDownMenu();
        var menuItem1 = new MenuItem({
            label: "Export to Excel",

            onClick: function () { alert('Export to Excel'); }
        });
        menu.addChild(menuItem1);

        var menuItem2 = new MenuItem({
            label: "Export to PDF",
            onClick: function () { alert('Export to PDF'); }
        });

        menu.addChild(menuItem2);

        var menuItem3 = new MenuItem({
            label: "Term Sheet",
            onClick: function () { alert('Term Sheet'); }
        });

        menu.addChild(menuItem3);

        var button = new DropDownButton({
            label: "Document",
            name: "dcment",
            dropDown: menu,
            id: "tvButton"
        });

        dom.byId("dropDownButtonDc").appendChild(button.domNode);



      });


   });


//end of TraderView(CDS) Actions Button
 </script>
4

1 回答 1

1

弹出z-index窗口是为每个弹出窗口计算的,因为您可以从弹出窗口打开一个弹出窗口,并且该子弹出窗口应该在父弹出窗口之上。你可以做的是设置_beginZIndexaka dijit/popup-PopupManager即第一个弹出窗口的值 - 1005 的值对我来说很好用 jQuery UI 对话框。

一个有效的 jsFiddle 示例:http: //jsfiddle.net/phusick/q8V58/

编辑: z-index: 1005对话框被 DnD 移动后似乎还不够,所以我放了 10000 以确保安全。

require([
    "dojo/ready",
    "dojo/dom",
    "dijit/popup",
    "dijit/form/DropDownButton",
    "dijit/DropDownMenu",
    "dijit/MenuItem"
], function(
    ready,
    dom,
    PopupManager,
    DropDownButton,
    DropDownMenu,
    MenuItem
) {

    ready(function() {

        // set z-index
        PopupManager._beginZIndex = 1005;

        var menu = new DropDownMenu();
        var menuItem1 = new MenuItem({
            label: "Export to Excel",
            onClick: function () { alert('Export to Excel'); }
        });

        var menuItem2 = new MenuItem({
            label: "Export to PDF",
            onClick: function () { alert('Export to PDF'); }
        });

        var menuItem3 = new MenuItem({
            label: "Term Sheet",
            onClick: function () { alert('Term Sheet'); }
        });

        menu.addChild(menuItem1);
        menu.addChild(menuItem2);
        menu.addChild(menuItem3);

        var button = new DropDownButton({
            label: "Document",
            name: "dcment",
            dropDown: menu,
            id: "tvButton"
        });

        button.startup();
        button.placeAt(dom.byId("dropDownButtonDc"));

        $("#dialog1").dialog({ title: "dialog1"});

    }); 
});​
于 2012-08-29T12:10:51.330 回答