Javascript 如何按类获取jqgrid的所有行ID
我想通过在gridcomplete中调用的方法中使用jqgrid的row css类来获取所有行ID,但它只返回当前页面的行。 我想获得jqgrid中存在的所有行ID。 下面是我的代码Javascript 如何按类获取jqgrid的所有行ID,javascript,jquery,jquery-ui,jqgrid,Javascript,Jquery,Jquery Ui,Jqgrid,我想通过在gridcomplete中调用的方法中使用jqgrid的row css类来获取所有行ID,但它只返回当前页面的行。 我想获得jqgrid中存在的所有行ID。 下面是我的代码 function GetAllCompanyProducts(productData) { /// <summary>method to load the Proposal grid</summary> //Load the grid var tabelWidth = $("#tblComp
function GetAllCompanyProducts(productData) {
/// <summary>method to load the Proposal grid</summary>
//Load the grid
var tabelWidth = $("#tblCompanyProducts").width();
jQuery("#tblCompanyProducts").jqGrid({
datatype: 'local',
data: productData,
jsonReader: { repeatitems: false },
loadui: "block",
autowidth: true,
mtype: 'get',
rowNum: 30,
rowList: [30, 100, 200],
viewrecords: true,
colNames: ['ProductId', 'ProductName', 'Price'],
colModel: [
{ name: 'ProductId', index: 'ProductId', width: '30%' },
{ name: 'ProductName', index: 'ProductName', width: '30%' },
{ name: 'Price', index: 'Price', width: '30%' }
],
sortname: 'ProductId',
sortorder: 'asc',
caption: "Product List",
width: tabelWidth - 10,
pager: '#divPager',
height: "100%",
hoverrows: true,
onPaging: function () {
$("#tblCompanyProducts").trigger('reloadGrid');
},
});
$("#tblCompanyProducts").jqGrid('setGridParam', { gridComplete: MakeGridRowsDraggable($("#" + this.id)) });
}
}
上面的代码只返回第一页中设置的行。
有人能帮我吗?请发布一些HTMLAR你确定隐藏的jqgrid“页面”是DOM的一部分吗?更新:我快速检查,告诉我它们不是。现在你应该告诉我你为什么需要它了?这篇文章已经编辑好了。请检查..A.Wolff,我试图在grid complete方法中使所有行都可以拖动,但是现在只有第一页的行可以拖动。你需要从插件API内部将这类功能绑定到元素。我已经有几年没有使用jQgrid了,但应该有您将使用的渲染回调。
function MakeGridRowsDraggable(grid) {
/// <summary></summary>
/// <param name="grid" type=""></param>
//$("#tblCompanyProducts").val(new Date().getTime());
var searchResultsRows = $("#tblCompanyProducts .ui-row-ltr");