jQGrid如何正确关闭分页 [英] jQGrid how to correctly turn off paging
问题描述
因此,根据该帖子但是我需要从服务器返回的json呢?
But what about json which i need to return from server,
var jsonData = new
{
total = totalPages,
page = page,
records = totalRecords,
rows = ...
}
在这种情况下,哪个值更好地分配给page
和totalRecords
?
在这种情况下,我应该更好地将它们传递为零,还是根本不起作用?
Which values better to assign to page
and totalRecords
in that case?
Should i better pass them as zeroes or it is doesn't mater at all in such case?
更新:
我想我会将records
设置为将要进入jason的行总数,并且page
和total
我将设置为1
I think i would set records
to total number rows that will go to jason, and page
and total
i will set to 1
您怎么看?现在我可以正确关闭jqGrid分页了吗?
What do you think? Anymore i can do to correctly turn off jqGrid paging?
推荐答案
将page
和total
设置为1,将records
设置为总数行是正确的.设置rowNum: 100000000
似乎太大.如果您真的要从服务器100000000
行中发回数据,则用户可能永远不会看到网格.将rowNum
设置为10000
似乎足够.
It's correct to place page
and total
to 1 and records
to the total number rows. The setting rowNum: 100000000
seems to too large. If you will really post back from the server 100000000
rows of data the user will probably never see the grid. It seems enough to set rowNum
to 10000
.
如果您不使用树状网格,则可以使用本地数据分页.在这种情况下,您只需要设置loadonce:true
.在这种情况下,服务器应将所有数据发布到客户端,而忽略输入rows
参数.看看使用5000个数据行的本地数据分页的演示此处并在此处中将结果与没有本地数据分页的相同演示进行比较.性能上的差异将显示为什么我建议您使用本地数据分页而不是在浏览器中滚动相同的数据.
If you don't use tree grid you can use local paging of data. In the case you need set just loadonce:true
. In the case the server should post all the data to the client and just ignore the input rows
parameter. Look at the demo which uses local data paging of 5000 rows of data here and compare the results with the same demo without local data paging here. The difference in the performance will show why I recommend you to use local data paging instead of scrolling the same data in the browser.
这篇关于jQGrid如何正确关闭分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!