ON 选择行即时调用
$('#grid').trigger('reloadGrid');
之后,当网格重新加载时,我希望这个节点展开并显示子节点。我试着做类似的事情
var rootNode = $('#grid').jqGrid('getRowData')[0];
$('#grid').jqGrid('expandRow' ,rootNode);
$('#grid').jqGrid('expandNode' ,rootNode);
$('#grid').jqGrid('setSelection',rootNode.id);
但这似乎不起作用,感谢任何帮助。
我的网格对象如下
var grid = $('#grid').jqGrid({
treeGrid: true,
treeGridModel: 'adjacency',
ExpandColumn: 'businessAreaName',
ExpandColClick : false,
url:'/records.do',
datatype: 'json',
mtype: 'GET',
colNames:['Id'
, 'Business Area'
, 'Investment'
],
colModel:[
/*00*/ {name:'Id',index:'Id', width:0, editable:false,hidden:true},
/*01*/ {name:'businessAreaName',index:'businessAreaName', width:160, editable:false}
],
treeReader : {
level_field: 'level',
parent_id_field: 'parent',
leaf_field: 'leaf',
expanded_field: 'expanded'
},
autowidth: true,
height: 240,
pager: '#pager',
sortname: 'id',
sortorder: 'asc',
caption:'ATP ScoreCard',
emptyrecords: 'Empty records',
loadComplete: function() {
designtable();
},
jsonReader : {
root: 'rows',
page: 'page',
total: 'total',
records: 'records',
repeatitems: false,
cell: 'cell',
id: 'agileProgrammeId'
},
beforeProcessing : function(data, status, xhr){
}
}
});