배열 데이터로 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"}]
사람이 도움을 줄 수 있습니까?