JQGrid - Changing the width of a column dynamically

javascript, jqgrid

Solution

You can set the new width of the column using two methods – setColProp and setGridWidth.

Here is example of setting new width of the column amount:

$("#mygrid").jqGrid('setColProp','amount',{width:new_width});

var gw = $("#mygrid").jqGrid('getGridParam','width');

$("#mygrid").jqGrid('setGridWidth',gw);

P.S. Note that in order to work this a shrinkToFit should be true, or you should call setGridWidth with second parameter true

Problem

I understand that the width of each column of jqgrid is defined using `colModel` parameter. Assuming I want to resize a column after I click a button, how can I perform this?

Original source

Related problems