1

I'm using jqGrid jqGrid 4.14.2-pre

How to hide or show buttons depending on the condition

Not using css

loadComplete:function(data)
{                   
    if(data.records > 100)
    {
        $('#grid').jqGrid('navGrid','#pager');
        // hide $('#grid').jqGrid('inlineNav','#pager'); ?
    }
    else
    {
        $('#grid').jqGrid('inlineNav','#pager');
        // hide $('#grid').jqGrid('navGrid','#pager'); ?
    }           
}   
Natasha
  • 13
  • 5

1 Answers1

0

I'd recommend you to call both navGrid and inlineNav, but to hide unneeded buttons identifying there by id. You should just know simple rule how the ids will be build. jqGrid uses prefix build on the navigator button ("add_", "edit_", "refresh_", ...) and the grid id ("grid" in your case). See the old answer for more details. The method inlineNav do the same, but the ids of buttons will be build base on another rule: the grid id and the suffix "_iladd" (for Add button), "_iledit" (for Edit button), "_ilsave" (for Save button) and "_ilcancel" (for Cancel button).

Let us you have grid with id="grid". To hide Add button added by navGrid you can use $("#add_grid").hide();. To hide inlineNav Add button you can use $("#grid_iladd").hide();.

Oleg
  • 220,925
  • 34
  • 403
  • 798