【问题标题】:UI and info_dialog JqgridUI 和 info_dialog Jqgrid
【发布时间】:2012-09-01 18:58:16
【问题描述】:

在使用 UI 对话框时如何设置 info_dialog 的 z-index?

【问题讨论】:

    标签: jqgrid


    【解决方案1】:

    $.jgrid.info_dialog 在内部使用$.jgrid.createModal,它使用了$.jgrid.jqModal(见the line),这是不久前引入的(见我的建议here)。所以你可以做类似的事情

    $.jgrid.jqModal = $.extend($.jgrid.jqModal || {}, {
        zIndex: 1234
    });
    

    由于navGrid的另一个参数,你必须额外添加

    $.extend($.jgrid.nav, {
        alertzIndex: 1234
    });
    

    使$.jgrid.jqModal.zIndex 设置工作。

    更新:您可以通过任何方式使用$.jgrid.info_dialog 的“子类化”(例如the answer)。对应的代码如下:

    var oldInfoDialog = $.jgrid.info_dialog;
    $.extend($.jgrid,{
        info_dialog: function (caption, content, c_b, modalopt) {
            if (modalopt && (modalopt.zIndex === null || modalopt.zIndex === undefined ||
                (typeof modalopt.zIndex === "number" && modalopt.zIndex < 1234))) {
    
                modalopt.zIndex = 1234;
            }
            return oldInfoDialog.call (this, caption, content, c_b, modalopt);
        }
    });
    

    【讨论】:

    • @DavidO.:您应该更准确地描述您的问题。您没有指定您使用的编辑模式。如果您使用表单编辑,则数据验证应该没有问题。我同意,jqGrid 在转发zIndex 时存在问题。如何解决问题有很多选择。可以修改一行jqGrid代码(herehere)或者覆盖info_dialog方法并调用原来的zIndex设置。
    • 我有:{name:'procent',index:'procent', width:70,align:'center',editable:true,editrules:{required:true}},and When field “procent”为空,出现info_dialog,但z-index为1000,在UI Dialog后面
    • @DavidO.:我间接认为您使用inline editingcell editing 而不是form editing。如果将您的问题附加到代码示例中会更好(只需单击问题文本下的“编辑”链接)。顺便说一句,值 1000 来自我引用的the line
    • @DavidO.:无论如何,您都可以通过使用“子类化”来解决问题:请参阅我的回答的 UPDATED 部分。
    • 谢谢。没关系。但是按close的时候会报错。TypeError: i.hideModal is not a function
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-09-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-28
    • 1970-01-01
    相关资源
    最近更新 更多