Question

Can anyone explain to me what i may be done wrong?

My treegrid is :

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});

And my json data is

{"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"]}, ....}

It shows up expanded grid and cant be collapsed ...

I really appreciate your help

TIA

Était-ce utile?

La solution

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".

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top