任何人都可以向我解释我可能做错了吗?
我的treegrid是:
var grid = $("#account");
jQuery(function($){
grid.jqGrid({
url: 'someurl',
datatype: 'json',
height: 'auto',
mtype: 'post',
colNames: ['Account Code','Account Name','Description','Account Type', 'Used By','Parent', 'Analysis 1', 'Analysis 2'],
colModel: [
{name:'szAccCode', index:'szAccCode', sortable:true, editable:true, editoptions:{readonly:'readonly'}},
{name:'szAccNm',index:'szAccNm',width:200, editable:true},
{name:'szAccNickNm',index:'szAccNickNm',width:250, editable:true},
{name:'szAccTypeNm',index:'szAccTypeNm',edittype:"select",editable:true,editoptions:{value:"<?php echo $stracctype; ?>"},editrules:{required:true}},
{name:'szUsedBy',index:'szUsedBy', width:100, editable:true},
{name:'szAccParentCode',index:'szAccParentCode', hidden:true},
{name:'szAccAnalysis_1',index:'szAccAnalysis_1', width:120, editable:true,edittype:"select",editoptions:{value:"<?php echo $straccanalys1; ?>"},editrules:{required:true} },
{name:'szAccAnalysis_2',index:'szAccAnalysis_2', width:120, editable:true,edittype:"select",editoptions:{value:"<?php echo $straccanalys2; ?>"},editrules:{required:true} }
],
rowNum: 20,
rowList: [20,40,60],
gridview: true,
viewrecords: true,
treeGrid: true,
treeGridModel: 'adjacency',
treedatatype: 'local',
ExpandColumn: 'szAccCode',
ExpandColClick: true,
pager: '#accountPager',
sortname: 'szAccCode',
sortorder:'asc',
caption: "Accounts", //Caption List
});
grid.jqGrid('navGrid','#accountPager',{edit:true,add:true,del:false, search:false});
我的json数据是
{"page":"1","total":1,"records":"276","rows":[ ... ,{"id":"6","cell":["300-0-000","Hutang Lancar","Hutang Lancar","Hutang Lancar banget","Select One","","HSS: Information system ","Technical Assistance","0","null","false","true","true"]},
{"id":"7","cell":["310-0-000","Cash Advance Activity","Cash Advance Activity","Aktiva Tetap","Select One","300-0-000","HSS: Information system ","Technical Assistance","1","300-0-000","false","true","true"]},
{"id":"8","cell":["311-0-000","Cash Advance Operational","Cash Advance Operational","Aktiva Tetap","Select One","310-0-000","HSS: Information system ","Technical Assistance","2","310-0-000","true","true","true"]},
{"id":"9","cell":["320-0-000","Cash Advance Travel on Duty","Cash Advance Travel on Duty","Aktiva Tetap","Select One","300-0-000","HSS: Information system ","Technical Assistance","1","300-0-000","false","true","true"]}, ....}
它显示扩展网格,无法折叠......
我真的很感谢你的帮助
TIA
答案 0 :(得分:0)
您对"parent"
列使用了错误的数据。它应包含父节点的id
,但您使用szAccCode
。您使用的值为"300-0-000"
和310-0-000"
,而不是"6"
和"7"
。