jquery jqgrid" page index"逻辑错误 [英] jquery jqgrid "page index" logical error

查看:103
本文介绍了jquery jqgrid" page index"逻辑错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Experts,



(Web应用程序信息 - 我正在使用ASP.NET MVC,.Net framework 4和C#)



我在网页(视图)上使用jqgrid来显示模型中的内容。



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.

$("#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

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

       }





我已经应用了虚拟滚动,所以每当用户在页面上滚动时,数据都将被加载到jqgrid中。



问题:

当我调试应用程序时,控制器中的page参数必须在每个滚动时显示增量值,但它的行为不正常。

- 如果我将sortOrder保持为desc,那么我在控制器中获得的页面值在第一遍中为1,在第二遍中为3,第三遍中的'5',依此类推。



- 如果我将sortOrder保持为asc,那么我在控制器中获得的页面值是第一次传球1,第二次传球2,第三次传球5,第四次传球6,依此类推。



我已经尽力找到问题所在,但我无法找到原因。 :(



任何帮助都将受到高度赞赏。

提前致谢。



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.

推荐答案

#list)。jqGrid({
url:' <%= @ Url.Action(ViewData,Data)%>'
数据类型:' json'
mtype:' GET'
...
...
...
toppager: true
pager:jQuery(' #pager'),
rowNum: 10
rowList:[ 5 10 20 50 ],
sortname:' ID'
sortorder: desc
multiselect: true
viewrecords: true
...
...
...
("#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

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

       }





我已经应用了虚拟滚动,所以每当用户在页面上滚动时,数据都将被加载到jqgrid中。



问题:

当我调试应用程序时,控制器中的page参数必须在每个滚动时显示增量值,但它的行为不正常。

- 如果我将sortOrder保持为desc,那么我在控制器中获得的页面值在第一遍中为1,在第二遍中为3,第三遍中的'5',依此类推。



- 如果我将sortOrder保持为asc,那么我在控制器中获得的页面值是第一次传球1,第二次传球2,第三次传球5,第四次传球6,依此类推。



我已经尽力找到问题所在,但我无法找到原因。 :(



任何帮助都将受到高度赞赏。

提前致谢。



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.


大家好,



我经过一些研究后得到了解决方案。



问题是由于这个问题而发生的在jqgrid。



我使用的是jqgrid版本4.4.1,我读到版本4.4.3解决了pagging bug



我试了一下,在我的应用程序中更新了最新版本(jqgrid版本4.4.4),现在所有的工作都很好。



问候,

Shivang
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


这篇关于jquery jqgrid&quot; page index&quot;逻辑错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆