Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqGrid: How can I change the width of the jqGrid?

Tags:

jquery

jqgrid

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?

like image 889
user603007 Avatar asked Aug 08 '12 07:08

user603007


People also ask

How do I select a row in Jqgrid?

Rows can be selected in ParamQuery Grid either by user action or programmatically. All rows can be selected using Ctrl - A or Cmd - A (Mac).

How do I sort a column in Jqgrid?

The value of sidx parameter will be constructed from sortname option of jqGrid and the value of sord from sortorder . So you should do the following: $('#yourgrid'). jqGrid('setGridParam', {sortname: 'yourColumn', sortorder: 'asc'}).

How do I get the value of a Jqgrid cell?

Read all dataIDs from grid:getDataIDs(); You can iterate on grid based on ID list. Then you will get row using dataID. When your entire row get done then you can get the cell value.

What is the use of Jqgrid?

jqGrid is an Ajax-enabled JavaScript control that provides solutions for representing and manipulating tabular data on the web.


1 Answers

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); 
 });
like image 152
Rohan Büchner Avatar answered Sep 24 '22 00:09

Rohan Büchner