Blogger Widgets
  • Sharing Photos using SignalR
  • TFS Extenstion - allows copy work items between projects
  • Displaying jquery progressbar with ajax call on a modal dialog
  • Managing windows services of a server via a website
  • Exploring technologies available to date. TechCipher is one place that any professional would like to visit, either to get an overview or to have better understanding.

Search This Blog

Tuesday, 14 February 2012

Handling JQGrid Autoheight on last page that has "rownum" less than "reccount"

One of the nice feature that JQGrid provides is enabling auto height using setGridHeight("100%"). This feature works fine except if the "number of rows on the current page" is less than "rows per page" which is last page, since it sets height to "100%" the height of the page is suddenly reduced.

Here is the sample screenshots taken from JQGrid demo website (goto Advanced -> Resizing)

First Page :

Last Page :

You wouldn't want this to happen if you got some more content after the grid. So now here is how you can fix this :-

loadComplete: function(data) {
   var rcPage = jQuery('#invoicesGrid').getGridParam('reccount');
   var rpPage = jQuery('#invoicesGrid').getGridParam('rowNum');                                
   var rowHeight = $('#invoicesGrid .ui-row-ltr').eq(0).height();
   if(rcPage < rpPage) {                                    
         var gridHeight = (rpPage * rowHeight);
         gridHeight += 10;  //row header height         
   else {

Just hook up this code to your jqgrid and this should do the trick.

A computer once beat me at chess, but it was no match for me at kick boxing. Emo Philips


Copyright © 2013 Template Doctor . Designed by Malith Madushanka - Cool Blogger Tutorials | Code by CBT | Images by by HQ Wallpapers