如何获取 jqGrid 的行数?
我想知道如何获取 jqGrid 的行数。我正在使用 rowNum: -1
因此它会显示所有行。我尝试使用:
parseInt($("#grid").getGridParam("records"), 10)
但它总是返回0
。
感谢您的帮助。
I would like to know how to get row count for jqGrid. I'm using rowNum: -1
so it displays all the rows. I tried using:
parseInt($("#grid").getGridParam("records"), 10)
But it always returns 0
.
Thanks for the help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试:
从 jqGrid 文档:
另请注意,正如 Mike 所评论的,您需要使用
getGridParam
方法和records
选项来检索所有行的计数如果您使用分页。Try:
from the jqGrid documentation:
Note also that, as Mike commented, you need to use the
getGridParam
method with therecords
option to retrieve a count of all the rows if you are using pagination.我尝试重新计数,结果为零,但以下内容对我有用。
I tried reccount and I got zero but the following worked for me.
这可能有点矫枉过正,不知道是否有更好的方法,但这对我有用:
This might be overkill and don't know if there's a better way, but this works for me:
我将网格数据获取到数组,然后使用数组长度函数来获取数组长度。它与jqgrid中的记录数相等。
i get the grid data to array and then use the array length function to get the array length. It is equal for the number of record in the jqgrid.