UI and info_dialog Jqgrid
Asked Answered
R

1

3

How do I set the z-index for info_dialog, when using UI dialog ?

Revanche answered 1/9, 2012 at 18:58 Comment(0)
D
2

$.jgrid.info_dialog uses internally $.jgrid.createModal which uses $.jgrid.jqModal (see the line) which introduced since not so long time (see my suggestion here). So you can do something like

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

because of another parameter of navGrid you have to add additionally

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

to make $.jgrid.jqModal.zIndex setting working.

UPDATED: In any way you can use "subclassing" of $.jgrid.info_dialog (like in the answer for example). The corresponding code could be like the following:

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);
    }
});
Dulles answered 1/9, 2012 at 19:38 Comment(8)
@DavidO.: You should describe your problem more exactly. You didn't specified the editing mode which you use. If you use form editing you should have no problems with the validation of data. I agree, that jqGrid has problems with forwarding of the zIndex. There are many options how the problem could be fixed. One can modify one line of jqGrid code (here or here) or overwrite info_dialog method and call the original one with zIndex set.Dulles
I have: {name:'procent',index:'procent', width:70,align:'center',editable:true,editrules:{required:true}},and When field " procent " is empty, info_dialog appear, but z-index is 1000, and behind UI DialogRevanche
@DavidO.: I suppose indirectly that you use inline editing or cell editing and not form editing. If would be better to append your question with the code example (just click on "edit" link under the text of the question). By the way, the value 1000 come from the line which I referenced.Dulles
@DavidO.: In any way you can solve the problem by the usage of "subclassing": see UPDATED part of my answer.Dulles
Thank you. It's ok. But an error occurs when you press the close.TypeError: i.hideModal is not a functionRevanche
@DavidO.: I can't see any errors. I inserted the code in one old demo and all seems to work. See the demo.Dulles
In your demo , inline editing on double-click, leave the name field blank, and save. appears info_dialog with error, then press the close buttonRevanche
@DavidO.: Ohh, yes. To fix the problem one should use .call with this: oldInfoDialog.call (this, caption, content, c_b, modalopt); instead of oldInfoDialog (caption, content, c_b, modalopt);. I fixed the text of the answer and the demo.Dulles

© 2022 - 2024 — McMap. All rights reserved.