JqGrid navbar only when required

Apr 14, 2012 at 1:20 AM

Is there a way that the navbar in jqgrid appears only when there are more rows than the rowsize of the grid. This would be very helpful in saving space on your page incase you have like 3 grids on the page.

I know enabling this would limit other features as well (like searching, refresh from navbar). But in my case I'm using navbar just for paging.

Coordinator
Apr 17, 2012 at 5:24 PM

Hi,

There is no built in functionality of jqGrid which can help you in this - the only way would be to modify the DOM yourself through JavaScript.

Apr 18, 2012 at 6:02 PM

Thanks for the reply Tomasz.

This is what I came up with.

 

function checkPager(){

       /* Dynamically show the pager if it’s needed */

       if(jQuery("#gridID").jqGrid('getGridParam','records') > jQuery("#gridID").jqGrid('getGridParam','rowNum')){

           jQuery("#gridIDPager").show();

       }

       else{

           jQuery("#gridIDPager").hide();

       }

   }

We can call the above function on appropriate events (adding\deleting rows, refreshing grid data etc.).

Can you please confirm that this would not create any further issues?