Serma Serma - 2 months ago 15
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 abc2@yahoo.com
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 abc2@yahoo.com


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

Answer

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:
http://jsfiddle.net/vvz2a3cy/