Showing posts with label columns. Show all posts
Showing posts with label columns. Show all posts

how to remove/disable column resize in jqGrid

jqGrid columns are set to resizable by default. Bit if you want to fix there size and want to disable or remove the resizable property then you can easily specify it in colmodel API. The colModel property defines the individual grid columns as an array of properties. This is the most important part of the jqGrid, and you can set the resizable variable of this array to false in order to disable the column resize.

jqGrid configuration option to remove column resize

var jqGridObj = $('#tableIdForGrid');

jqGridObj.jqGrid({  
...,
"colModel" : [
{
"name":"description",
"index":"description",
"align":"left",
"sorttype":"text",
"width" : 50,
"resizable": false,
}
],
...,
});



Other Imp variables of comModel API > click here

how to set width of column of jqGrid

Working on jqGrid, and want to change the width of columns? You are landed at a right place take a look at following discussion to get it done quickly. jqGrid is very easy to configure and it has lots of functions and variables to customize it as per our needs.

use this in jqGrid configuration code

var jqGridObj = $('#tableIdForGrid');

jqGridObj.jqGrid({  
...,
"colModel" : [
{
"name":"description",
"index":"description",
"align":"left",
"sorttype":"text",
"width" : 50, 
}
],
...,
});

Explanation
You can easily set the width of every column of jqGrid by the configuration variable width in colModel property of jqGrid. Above sample code is self explanatory.

SHARE