jqGrid: How can I change the width of the jqGrid?
Asked Answered
V

1

7

I would like to change the width of a jqGrid. I tried to set the width in my griddefinition:

   width: '800px'

Is there another way?

Viviennevivify answered 8/8, 2012 at 7:2 Comment(0)
J
26

You could use the setGridWidth property

 $('#gridId').jqGrid('setGridWidth', '800');

If you want the grid to re-size dynamically, hook into the window re-size function, but remember to set the initial width

 var DataGrid = $('#gridId');

 //sets the grid size initially
 DataGrid.jqGrid('setGridWidth', parseInt($(window).width()) - 20);    

 //handles the grid resize on window resize
 $(window).resize(function () { 
       DataGrid.jqGrid('setGridWidth', parseInt($(window).width()) - 20); 
 });
Joanne answered 8/8, 2012 at 7:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.