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

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

问题描述

我正在尝试显示jqGrid表中的所有行.我知道我可以使用rowList让用户选择要查看的行数,但是如何放置一个选项以查看所有行呢?如果放置一个像999999999这样的数字,则会显示所有行,因为行数较少,但用户会看到该大数字是一个选择,而且不太合逻辑.

I'm trying to show all rows in a jqGrid table. I know I can use rowList to let the user choose how many rows wants to see, but how can I put an option to see all rows? If a put a number like 999999999, it will show all rows because there are less rows, but the user will see that big number as an option and is not too logic.

推荐答案

您可以在rowList中使用单词代替数字,如下所示:

You can use words instead of numbers in rowList as follows:

rowList:['All','100','500','1000']

然后,您必须使用服务器控制器将该信息转换"为要显示的许多行. 我是这样做的:

Then you have to use your server controller to "convert" that information to a number of rows to show. I did it like this:

Integer intRows = 0;
if (rows.getClass().equals(String.class) && ((String)rows).equalsIgnoreCase("all")) {
    intRows = Integer.MAX_VALUE;
} else {
    intRows = Integer.valueOf(rows);
}

因此,如果用户选择全部"或其他情况下的行数,则服务器将显示Integer.MAX_VALUE. 我认为您表中的行数不会超过Integer.MAX_VALUE,这是一个很大的数字!

So your server will show Integer.MAX_VALUE if user selects "All", or a number of rows it other case. I think you won't have more than Integer.MAX_VALUE rows in your table, it's such a big number!

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

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