0

I need to adjust my jqgrid height dynamically to fit in the browser window as screen resolution changes.I need to calculate the header and footer ,and form(optional)..Then grid should be fitted in the remaining space.

Brittas
  • 491
  • 1
  • 5
  • 18

1 Answers1

0

You could set the height of the .ui-jqgrid-bdiv element via css calculating the height based on the window.innerHeight property.

Like here I will set the grid height to be 70% of the available window space:

$("#gview_mygrid > .ui-jqgrid-bdiv").css('height', window.innerHeight * .7);

You would need to recalculate this on each resolution change but that should be pretty straight forward.

rg88
  • 20,742
  • 18
  • 76
  • 110
  • using window.innerHeight we can get the screen height. My question is that in my browser, besides the grid there will be a header and a footer.In some page there will be some also.I need to fit my grid in rest of the space (the free space remaining after header,footer and form taken) irrespective of change in my screen resolution and that too dynamically. – Brittas Mar 29 '12 at 08:51
  • Leave the above thing , i need to set the grid height as same as of the browser height and when i resize my browser the same time the grid height also need to resize, help me with an jquery to do the same – Brittas Apr 04 '12 at 05:58