jqGrid trigger “Loading…” overlay

后端 未结 9 1879
孤独总比滥情好
孤独总比滥情好 2020-12-03 08:24

Does anyone know how to trigger the stock jqGrid \"Loading...\" overlay that gets displayed when the grid is loading? I know that I can use a jquery plugin without much eff

9条回答
  •  余生分开走
    2020-12-03 08:59

    As mentioned by @Oleg the jQuery Block UI have lots of good features during developing an ajax base applications. With it you can block whole UI or a specific element called element Block

    For the jqGrid you can put your grid in a div (sampleGrid) and then block the grid as:

    $.extend($.jgrid.defaults, {
        ajaxGridOptions : {
            beforeSend: function(xhr) {
                $("#sampleGrid").block();
            },
            complete: function(xhr) {
                $("#sampleGrid").unblock();
            },
            error: function(jqXHR, textStatus, errorThrown) {
                $("#sampleGrid").unblock();
            }
        }
    });
    

提交回复
热议问题