Saturday, October 23, 2010

jqGrid integer sorting

I am working with jqGrid these days and sorting a column with integers was messed up... I was getting the following result:
















It turns out that jqGrid treats a column data as text by default - but you can set it to int or integer to get correct integer sorting

So set sorttype: "integer" in your colModel options

colModel: [{
    name: 'ID',
    index: 'ID',
    sorttype: "int",
    width: 12
},
 
And you will get correct sorting for your numerical columns















More on colModel options here

No comments:

Followers