我有一个像下面这样的jqGrid(部分代码)
$(function() {
options = $("#pdbconfiggrid").jqGrid({
url:URL,
datatype: 'json',
mtype: 'GET',
colNames:['Display Name','Property Name', 'Property Value', 'Group Type'],
colModel:[
{name:'display_name',index:'key',editable:false,sortable:false, width:30},
{name:'key',index:'_key', hidden:true},
{name:'value',index:'value', editable:false,sortable:false, width:100, formatter:returnPropertyValue},
{name:'group',index:'group',sortable:false, hidden:true, width:30},
],
postData: {},
rowNum: -1,
height: 'auto',
headertitles:true,
autowidth: true,
viewrecords: false,
toppager: false,
emptyrecords: "Empty records",
cmTemplate: { title: false},
loadonce: false,
altRows: true,
sortname: 'index',
sortorder: "asc",
grouping:true,
groupingView : {
groupField : ['group'],
groupColumnShow : [false],
groupCollapse : true,
groupSorted: false,
groupDataSorted: false
},
我正为此网格设置多个组值(如A,B,C,D)。 现在,我怎样才能获得所有关键&给定grop名称上特定组的值 比如jqGrid.getGroupData(" A");
感谢
答案 0 :(得分:0)
我试过这样的。它的工作原理
function getGroupData(group_name) {
var rowData;
var complete_data = jQuery("#syncconfiggrid").jqGrid('getRowData');
var group_data = {};
for (var index in complete_data) {
rowData = complete_data[index];
if (group_name == rowData.group) {
var prop_key = rowData.key;
if (null != prop_key && prop_key.length > 2)
group_data[prop_key] = $('#' + prop_key.replaceAll(".", "_")).val(); // this is my code specific
}
}
return group_data;
}