jayAnn
jayAnn

Reputation: 839

json from a server wont sort in jqgrid using "sorttype:'int'"

gud day all. i have this maybe simple problem for you. i have a program that will display my data to a jqgrid., it was interpreted as json. Now, the sorting is okay but there's just this little prob that i still haven't fix.

when i click the column header code number, it sorts as 1, 10, 11, 12....2, 20, 21...and so on. what i want to display in the grid is 1, 2, 3, 4, 5.....

i already used this code {name:'code', index:'code', sorttype :'int'} but still it doesn't show what i want. can please anybody help me with this? please.

EDIT

i think maybe it was because, json is a string. don't we have any option to convert it or make it something like integer type just to sort?

Upvotes: 2

Views: 3005

Answers (1)

tpeczek
tpeczek

Reputation: 24125

The sorttype option is used only when you have datatype set to local, which means you have data defined at client side (array data). If you are providing data form server in JSON format, the actual sorting is also happening on the server and this is were you need to modify your sorting routine.

Upvotes: 3

Related Questions