jqGrid colModel properties with examples

jqGrid is Javascript plugin that displays data in a tabular format with various configurations. As you have seen in the last post colModel plays an important role in defining the structure of the grid. colModel has various properties that we will explore in this post

jqGrid colModel properties

1. name : name /id of the column. required property
2. label : Displays as header of the grid column. If no specified then name property value is used as header value.
3. align : alignment of the data values in that particular column. Values can be – left, right, center
4. width : sets width of column in pixels.
5. firstsortorder : Sorts the columns on load for the first time – asc or desc
6. sorttype : Defines the type on which sorting needs to happen – string, date, number etc
7. sortable : Sets if column can be sortable. default:true
8. resizable : Sets if column can be resizable. default:true
9. editable : Sets if column values can be editable. default:false
10. template : Can be used to override the default values of the column.
11. formatter : Can define a predefined or a custom formatter for the data in the column. We wil take a closer look at this option in our next coming posts.
12. formatoptions : Can be used with formatter. More to come on this when we write about formatters

Using the above properties, lets see an example on how to use them in the colModel


jqGrid colModel properties Example

1. Getting Starter jqGrid
2. colModel wiki

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn