以编程方式选择jqgrid所有页面的所有行? [英] selecting all the rows of all the pages of a jqgrid programmatically?
问题描述
我想以编程方式在jqgrid中选择所有页面的所有行,以进行批处理更新实用程序.我该如何做到这一点?我尝试了很多东西,但似乎都没有用.谁能指出我正确的方向. 我的代码如下:
I want to select all the rows of all the pages in a jqgrid programatically for a batch update utility. how do i achieve this? I have tried a lot of things but none seem to work. Can anybody point me in the right direction. My code is as follows:
var tot_rows=$("#template-list").jqGrid('getGridParam', 'records');
for(var i=1; i<=tot_rows; i++)
{
$('#template-list').setSelection(tot_rows[i], true);
}
谢谢
Anita
推荐答案
我之所以选择jqgrid的所有行,是为了让我可以使用selarrrow获得所有ID的ID.但是我终于弄清楚了,既然那是我要选择所有这些的唯一原因,我也可以通过以下方式做到这一点
The reason why i wanted to select all the rows of jqgrid is so that I can get the ids of all of them using selarrrow . But I finally figured out that since thats the only reason I had wanted to select all of them , I could do that in the following way too
var tot_rows=$("#template-list").jqGrid('getGridParam', 'records');
var mydata = $('#template-list').jqGrid('getGridParam','data');
var indexes = $('#template-list').jqGrid('getGridParam', '_index');
for(var i=1; i<=tot_rows; i++)
{
recId=mydata[indexes[i]].recId;
//some processing
}
它有效!!!感谢你们俩的时间和帮助!!!
And it works!!! Thanks to both of you for your time and help!!!
这篇关于以编程方式选择jqgrid所有页面的所有行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!