Sandeep Raju
Sandeep Raju

Reputation: 31

How to hide nav bar in Jqgrid and dynamically reload with new values

Is there any way to hide the nav-bar in jqgrid and reappear on selecting the row? And how to reload the grid dynamically after selecting new value

Upvotes: 1

Views: 319

Answers (1)

Oleg
Oleg

Reputation: 221997

To show or to hide the navigator bar one need to call show/hide jQuery-method on the div having "navtable" class. The div contains all buttons on the bar. If you use, for example, pager: "#mypager" then to hide the navigator bar one need do the following:

$("#mypager").find(".navtable").hide();

In more common case you can use the method

var visibilityNavBar = function (show) {
    var pagerSelector = $(this).jqGrid("getGridParam", "pager");
    $(pagerSelector)
        .find(".navtable")[show ? "show" : "hide"]();
};

and to call it inside of onSelectRow callback

onSelectRow: function (rowid, status) {
    visibilityNavBar.call(this, status);
}

To hide the navigator bar initially you can call

visibilityNavBar.call($("#list")[0], status);

directly after calling of navGrid method.

The demo https://jsfiddle.net/OlegKi/s2qkh9mn/ demonstrates the code. On selecting of a row the nav-bar will be displayed, on deselection it will be hidden.

Upvotes: 1

Related Questions