0

谁能向我解释我可能做错了什么?

我的树形网格是:

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

4

1 回答 1

0

You use wrong data for "parent" column. It should contains the id of parent node, but you use szAccCode. You use values like "300-0-000" and 310-0-000" instead of "6" and "7".

于 2013-05-20T14:44:57.023 回答