disabling modal popup in jqgrid

2019-07-03 16:20发布

I want to create a custom message without using the modal popup in jqgrid. Is there a way to disable it? Or is there a way to change the contents of the modal?

5条回答
走好不送
2楼-- · 2019-07-03 16:56

Can you be more specific? If you want your own modal dialog, you could just add an event handler (on an Edit button, for example) that when fired will open your own custom dialog. You can use the jQuery UI dialog for this purpose, and just have it open to your own custom form.

Update After inspecting the jqGrid source code, info_dialog is the function that is used to display this particular dialog. There is a separate call to display the "Loading..." popup. Offhand there does not seem to be a simple way to disable info_dialog. However, you could modify the jqGrid source to accomplish what you need. You could either:

  • Return immediately from info_dialog - which may be extreme because it could report other errors you need - or,

  • Find and comment out the call that is displaying this particular ajax error. There is some trial-and-error involved, but with only 18 calls to this function it will not take you long to track down. In fact, start by commenting out this instance, since it is called from the error function of an ajax call:

    info_dialog(a.jgrid.errors.errcap,e.status+" : "+e.statusText+"<br/>"+u,a.jgrid.edit.bClose);

Obviously such a modification is a last resort, but once it works you might consider rolling a patch for the jqGrid team to disable the alert.

查看更多
不美不萌又怎样
3楼-- · 2019-07-03 16:56

I know this is out of the topic, but have you tried SlickGrid http://wiki.github.com/mleibman/SlickGrid/examples.

查看更多
孤傲高冷的网名
4楼-- · 2019-07-03 17:03

Search for div.loadingui div.msgbox { ... } somewhere in css files. I think editing this css class will get the job done.

查看更多
Explosion°爆炸
5楼-- · 2019-07-03 17:03

Yes you can do it. you can make visible property to false [$("#info_dialog").visible(false);] of the modal box, and you can call what ever your custom modal box.

editrules: { custom: true, custom_func: validate_edit }


function validate_edit(posdata, colName) {
            var message = "";
            if (posdata != '' && $.isNumeric(posdata))
                return [true, ""];

            if (posdata == '')
                message = colName + " field is required"
            if (!$.isNumeric(posdata))
                message = posdata + " is not a number";

            alert(message);

            $("#info_dialog").visible(false);

            return [false, ""];
        }
查看更多
爱情/是我丢掉的垃圾
6楼-- · 2019-07-03 17:19

i have changed the z-index of modal popup on runtime once you can access to it you can do any customization

editoptions: { size: 20, maxlength: 10,

                            dataEvents: [
                          { type: 'keypress',
                              fn: function (e) {
                                  if (e.keyCode == 13) {
                                      **$("#info_dialog").css('z-index', '100000');**
                                  }
                              }
                          }
                       ]


                        } }

Also, if you can do it on another place if you have server response such as error

onCellSelect: function (rowid, iCol, aData) {
                    currentRow = rowid;
                    if (rowid && rowid !== lastsel) {
                        if (lastsel) jQuery('#ppGrid').jqGrid('restoreRow', lastsel);
                        $("#ppGrid").jqGrid('editRow', rowid, true, null, null, null, {}, reload,OnError);
                        lastsel = rowid;
                    }
                    else if (rowid && rowid === lastsel)
                    { $("#ppGrid").jqGrid('editRow', rowid, true, null, null, null, {}, reload,OnError); }


                }
查看更多
登录 后发表回答