I am implementing Jqgrid in Asp.net MVC Application. I am doing server side paging and sorting.

Every thing is working fine.i was able to sort and page good. but, the only problem is the intial load.

When ever the grid is loading , it is skipping one record and then displaying other records.

The page parameter that the Jqgrid is sending via Ajax request, the default is coming as 1 instead of -1 or 0.

Because, in the first load, there are records to be skipped so it should ideally be -1 or 0.

Please help me how to sort out this issue..

有帮助吗?

解决方案

The value of page parameter which will be sent to the server is 1-based page and not 0-based like you want. The server should skip (page - 1)*rows records at the beginning of the resulting set and returns rows records. If you are the owner of the code of ASP.NET MVC Application you can just make the above simple calculations on the server side. Only if you really don't able to change existing server code you can decrement page value on the client side. To do this you need just implement serializeGridData callback. See an example of the code in the answer.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top