JQGrid:从不同页面获取元素 [英] JQGrid: Get elements from different pages
问题描述
我有一个JQGrid,其中包含24个元素,每页10个元素.
I have a JQGrid with 24 elements, 10 elements by page.
运行以下行时,位于第三页:
When I run the following line, being on the 3rd page:
var idList = $(MyList).getDataIDs();
我只能从第三页获得4个元素.
I can only get the 4 elements from the 3rd page.
如何从整个列表中获取元素?
How can I get the elements from the whole list?
我尝试过:
$(MyList).jqGrid('getGridParam','data');
但是我得到了
[]
推荐答案
是您datatype: "local"
还是将远程数据源(datatype: "json"
或datatype: "xml"
)与loadonce: true
一起使用然后将填充data
和_index
参数.选项data
是项目数组.选项_index
是一个对象,其属性是已加载数据的id值.您可以使用for
循环遍历所有id.请参见答案或旧版本一个以获取更多信息.在某些情况下,使用getLocalRow
方法通过id访问data
数组中的项目是很实际的.
It you datatype: "local"
or if you use remote data source (datatype: "json"
or datatype: "xml"
) together with loadonce: true
then data
and _index
parameters will be filled. The option data
is array of items. The option _index
is an object which properties are id values of the loaded data. You can use for
loop to iterate over all ids. See the answer or this old one for more information. In some scenarios it would be practical to use getLocalRow
method to access items from data
array by id.
这篇关于JQGrid:从不同页面获取元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!