Click here to Skip to main content
15,887,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Experts,

(Web application information- I am using ASP.NET MVC, .Net framework 4 and C#)

I am using jqgrid on a webpage(view) to display contents from model.

JavaScript
$("#list").jqGrid({
            url: '<%= @Url.Action("ViewData", "Data") %>',
            datatype: 'json',
            mtype: 'GET',
            ...
            ...
            ...
            toppager: true,
            pager: jQuery('#pager'),
            rowNum: 10,
            rowList: [5, 10, 20, 50],
            sortname: 'ID',
            sortorder: "desc",
            multiselect: true,
            viewrecords: true,
            ...
            ...
            ...


and my controller is this

C#
[SessionExpireFilter]
       public ActionResult ViewData(string sidx, string sord, int page, int rows ,GridSettings grid)
       {
           // code goes here..
           // return JSON object.

       }


I have applied Virtual Scrolling, so whenever the user will scroll on the page, the data will be loaded in jqgrid.

PROBLEM:
When I debugged the application, the "page" parameter in controller must show incremental values at each scroll but it is not behaving normally.
-If I keep the "sortOrder" as "desc" then the "page" values I get in controller are '1' in first pass, '3' in second pass, '5' in third pass and so on.

-If I keep the "sortOrder" as "asc" then the "page" values I get in controller are '1' in first pass, '2' in second pass, '5' in third pass, '6' in fourth pass and so on.

I have tried my level best to find out where the problem lies but I am not able to find the reason behind this. :(

Any help would be highly appreciated.
Thanks in advance.
Posted

1 solution

Hello folks,

I got the solution after some more research.

The problem was occurring due to the bug in jqgrid.

I was using jqgrid version 4.4.1 and I read that pagging bug was solved in version 4.4.3

I gave a try, updated the latest version ( jqgrid version 4.4.4) in my application and now all's working perfectly fine.

Regards,
Shivang
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900