jqGrid trigger “Loading…” overlay

后端 未结 9 1808
孤独总比滥情好
孤独总比滥情好 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 09:01

    I just placed below line in onSelectRow event of JQ grid it worked.

    $('.loading').show();

    0 讨论(0)
  • 2020-12-03 09:01

    If you want to not block and not make use of the builtin ajax call to get the data

    datatype="local"

    you can extend the jqgrid functions like so:

    $.jgrid.extend({
        // Loading function
        loading: function (show) {
            if (show === undefined) {
                show = true;
            }
            // All elements of the jQuery object
            this.each(function () {
                if (!this.grid) return;
                // Find the main parent container at level 4
                // and display the loading element
                $(this).parents().eq(3).find(".loading").toggle(show);
            });
            return show;
        }
    });
    

    and then simple call

    $("#myGrid").loading(); 
    

    or

    $("#myGrid").loading(true); 
    

    to show loading on all your grids (of course changing the grid id per grid) or

    $("#myGrid").loading(false); 
    

    to hide the loading element, targeting specific grid in case you have multiple grids on the same page

    0 讨论(0)
  • 2020-12-03 09:04

    You can call $("#load_").show() and .hide() where is the id of your grid.

    0 讨论(0)
提交回复
热议问题