Serma Serma - 1 year ago 65
jQuery Question

JqGrid Column Sorting on EMAIL

I am trying to sort the email column using JqGrid, but it is behaving inconsistently.

For example, if my grid is below

Name Phone Email
Name A 123456 ABCDEFG
Name B 654321
Name C 987456 PETER.WI

If i am trying to sort the above grid by using Email column it is not giving expected output, instead it is giving output like below if I am trying sort in ascending order.

Name Phone Email

Name C 987456 ABCDEFG
Name B 654321 PETER.WI
Name A 123456

My guess is JqGrid not working for column which is containing @ symbol.

Answer Source

Don't forget to set the sorttype of the column:

sorttype: "string"

(or at least make sure you don't put there int/float).

Here is a working example: