2

Can anyone please tell me how to sort integers/numbers in JQ grid. the regular sorting gives a distorted order.

Hi i got it all done when i use loadonce=true and sorttype = 'int'. But i cant use loadonce, since i need to reload the grid several times for my purpose.

Can anyone say how to do it without using loadonce??

Thanks, Devan

Devan
  • 172
  • 1
  • 6
  • 15
  • Do use use jqGrid with local data or with the data from the server? Which value has `datatype` parameter of jqGrid? It is always better to post the code which you currently use and which has the problem. – Oleg May 11 '11 at 11:03
  • Have you tried setting sorttype of your column in colModel as `sorttype: 'number'` – sohaiby May 23 '15 at 10:19

1 Answers1

1

If you use datatype:'json' or datatype:'xml', then the server is responsible for the data sorting. The sidx and the sord parameters which will be send as the part of request to the server describes which sorting should use the server.

If you want to implement client side sorting and paging of data you can use loadonce:true jqGrid parameter. In the case you should define sorttype property (having default value 'text') which describes the data type from the column. After the first data loading the datatype of the jqGrid will be automatically changed to 'local' and the sorting, paging and filtering/searching of data will be implemented locally by jqGrid itself.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • 1
    thnks for the reply, but as i said i dont want to use loadonve:true, it works well when i use loadonce:true and sorttype:int. i use datatype:'json'. so how can i use int sorting without loadonce. i cant understand the first part of your answer may be because i'm new to jqgrid.sorry for that can you Please explain how to do that. – Devan May 12 '11 at 09:44
  • @Devan: If you don't know what are the `sidx` and the `sord` parameters you should better modify your question and append it with the code which you use. Moreover the implementation of the server means one from many variation of languages which you use. I use ASP.NET. In the "UPDATED" part of [the question](http://stackoverflow.com/questions/5500805/asp-net-mvc-2-0-implementation-of-searching-in-jqgrid/5501644#5501644) for example you can find and download an example which shows how to implement all: sorting, paging and filtering on the server side in ASP.NET MVC 2.0. – Oleg May 12 '11 at 10:01