JqGrid: How can I change the width of jqGrid?

I would like to change the jqGrid width. I tried to set the width in my grid definition:

width: '800px' 

Is there another way?

+4
source share
1 answer

You can use the setGridWidth property

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

If you want the grid to change dynamically, connect to the window resizing function, but do not forget 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); }); 
+20
source

All Articles