jqGrid don't provide any method which can be used to change the width
after the grid is created. The method setColProp
just applies the changes on the corresponding item of colModel
, but it *don't applies the changes on the grid.
Nevertheless I wrote setColWidth
which allows to change the column width. You can download the latest version of setColWidth
from github, include jQuery.jqGrid.setColWidth.js
file after jquery.jqGrid.min.js
. After that you can use
$("#UsersGrid").jqGrid("setColWidth", "colname", newColumnWidth);
or
$("#UsersGrid").jqGrid("setColWidth", "colname", newColumnWidth, false);
which don't adjust the width of the grid additionally after changing the size of the column. The first call (without false
) is especially suitable in case of usage shrinkToFit: true
option.
You can find the demo which usessetColWidth
in the answer for which I initially developed the setColWidth
method.
UPDATE: setColWidth
is the part of free jqGrid. Thus one need just update to the latest version of jqGrid to be able to use setColWidth
method.