Skip to content

Instantly share code, notes, and snippets.

@extstopcodepls
Last active August 29, 2015 13:56
Show Gist options
  • Save extstopcodepls/9206564 to your computer and use it in GitHub Desktop.
Save extstopcodepls/9206564 to your computer and use it in GitHub Desktop.
jqgrid autoresize
function autoresizeGrid() {
var $grid = $(this);
var columns = $grid.jqGrid('getGridParam', 'colModel');
var colsTotalWidth = 0;
for (var i = 0; columns[i]; i++) {
colsTotalWidth += columns[i].width;
$grid.setColProp(columns[i].name, { width: columns[i].width, widthOrg: columns[i].width });
}
colsTotalWidth += 50;
$(this).jqGrid('setGridWidth', colsTotalWidth, true);
}
// usage in init
// resizeStop : autoresizeGrid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment