0
我想加載TreeGrid(jqGrid)的數組數據。但不知何故,層次結構不顯示。數據僅出現在扁平結構中。jQuery的 - 加載jqGrid - TreeGrid的陣列數據
代碼:
$("#list").jqGrid({
treeGrid: true,
treeGridModel: 'adjacency',
ExpandColumn: 'label',
ExpandColClick: true,
datatype: 'local',
colNames:['Parent','Org','cd'],
colModel:[
{name:'parent',id:'parent',index:'parent', width:250, hidden: true,
align: 'left', sortable: false, classes: 'indeling', title: false },
{name:'label',id:'label',index:'label', width:250,align: 'left',
sortable: false, classes: 'indeling', title: false, visible: false},
{name:'cd',id:'cd',index:'cd', width:100,align: 'left', sortable: false,
classes: 'indeling', title: false,visible: false }
],
rowNum: 20000,
viewrecords: true,
height: "100%",
treeIcons: { leaf: 'ui-icon-document-b' },
hoverrows: false
});
然後我在陣列中添加的行格:陣列的
$('#list').jqGrid('addRowData',0,array[0]);
$('#list').jqGrid('addRowData',1,array[1]);
結構:
array=[{parent:"",label:"1",cd:"32"},{parent:"1",label:"2",cd:"42"}]
誰能幫助?