如何显示jqGrid中的所有行? [英] How to show all rows in the jqGrid?

查看:168
本文介绍了如何显示jqGrid中的所有行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

jqGrid公开属性 rowNum ,您可以在其中设置要为每个页面显示的行数。如何将网格设置为仅显示所有行?

jqGrid exposes a property rowNum where you can set the number of rows to display for each page. How do you set the grid to just display ALL rows?

现在我只是将 rowNum 设置为一些非常高的东西,如<%= int.MaxValue%> ,但我想知道是否有更好的方法。

Right now I'm just setting the rowNum to something really high like <%= int.MaxValue %> but I'm wondering if there is a better way.

推荐答案


在最新版本的jqGrid中,您可以将rowNum设置为 -1 以指示网格始终显示全部行:

In the latest version of jqGrid, you can set rowNum to -1 to instruct the grid to always display all rows:

rowNum: -1

请参阅最新的jqGrid文档此处

See the latest jqGrid documentation here.

具体来说:


设置我们要在网格中查看的记录数。此参数传递给url以供检索数据的服务器例程使用。请注意,如果将此参数设置为10(即检索10条记录)并且服务器返回15,则只会加载10条记录。将此参数设置为-1(无限制)以禁用此检查。






更新

不幸的是,这种行为在jqGrid 3.6.3中被破坏了。根据来自Tony的这篇文章

Unfortunately this behavior was broken in jqGrid 3.6.3. According to this post from Tony:


是的,这是真的。原因是新推出的卷轴:1。在将来我们将纠正这种行为。

Yes, this is true. The reason is the new introduced scroll:1. In the future we will correct this behavior.

因此jqGrid开发人员意识到这个问题,显然正计划将其修复为未来发布。很遗憾这篇文章来自一年多以前...

So the jqGrid developers are aware of this problem and apparently are planning to fix it in a future release. Unfortunately this post was from over a year ago...

目前,我所能推荐的是你设置 rowNum 到一个非常大的数字来模拟 -1 的行为。

At this time, all I can recommend is that you set rowNum to a very large number to simulate the behavior of -1.

您还可以尝试使用 rowNum:''下面的whatispunk解决方案。但是,我在包含本地数据的网格上尝试了这个( loadonce:true )。在尝试对行进行排序时,所有网格的本地数据都将消失。因此,对于具有本地数据的网格,此解决方案似乎不起作用,除非在更高版本的jqGrid中修复了此缺陷(我在jqGrid 3.8.2上测试过它)。如果您有任何反馈意见,请在下面发表评论!

You can also try whatispunk's solution below of using rowNum: ''. However, I tried this on a grid containing local data (loadonce: true). When attemping to sort the rows all of the grid's local data would disappear. So this solution does not seem to work for grids with local data, unless this defect has been fixed in a later version of jqGrid (I tested it on jqGrid 3.8.2). If you have feedback, please post a comment below!



更新 - 2014年4月16日

根据jqGrid团队这是现在修复:


我已经添加了支持,可以在寻呼机选择框中设置不同的显示值,包括所有的-1。

I have added support to set different display values on pager select box including -1 for all.

我没有机会测试确认修复。据推测,此更改将在jqGrid 4.6.0之后的下一个版本中发布。

I have not had a chance to test to confirm the fix, though. Presumably this change will be in the next release after jqGrid 4.6.0.

这篇关于如何显示jqGrid中的所有行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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