jqgrid下treeGrid的插件配置


function gridList() {
var $gridList = $("#gridList");
$gridList.jqGrid({
treeGrid: true, 
datatype: "json",
autowidth: true,
//rownumbers: true,
shrinkToFit: false,
gridview: true,    
treeGridModel: "adjacency",
ExpandColumn: "org_name",
url: "/index.php/organise/organise_list",
height: $(window).height() - 96,
colModel: [
{ label: "主鍵", name: "org_Id", hidden: true, key: true },
{ label: '名稱', name: 'org_name', width: 200, align: 'left' },
{ label: '編號', name: 'org_num', width: 150, align: 'left' },
{ label: '分類', name: 'org_category', width: 150, align: 'left' },
{ label: '備注', name: 'description', width: 150, align: 'left' },

{ label: '操作', name: 'org_Id', width: 150, align: 'center',
formatter: function (org_Id,options, rowObject) {
var showStatus=rowObject.is_delete==0?"啟用":"禁用";
return '<a href="/index.php?/organise/organise_edit/'+org_Id+'">編輯</a> | <a href="/index.php?/organise/organise_del/'+org_Id+'">'+showStatus+'</a></td>';

}
}    
]
});
}

 

 

{
    "rows": [
        {
            "level": 1,
            "isLeaf": false,
            "expanded": true,
            "org_Id": "2",
            "parent": "1",
            "org_name": "北京偉景行股份有限公司",
            "org_num": "",
            "org_category": "公司",
            "description": ""
        },
        {
            "level": 2,
            "isLeaf": true,
            "expanded": false,
            "org_Id": "3",
            "parent": "2",
            "org_name": "行政部",
            "org_num": "",
            "org_category": "部門",
            "description": ""
        },
        {
            "level": 2,
            "isLeaf": true,
            "expanded": false,
            "org_Id": "4",
            "parent": "2",
            "org_name": "財務部",
            "org_num": "",
            "org_category": "部門",
            "description": ""
        },
        {
            "level": 2,
            "isLeaf": true,
            "expanded": false,
            "org_Id": "5",
            "parent": "2",
            "org_name": "信息部",
            "org_num": "",
            "org_category": "部門",
            "description": ""
        },
        {
            "level": 1,
            "isLeaf": false,
            "expanded": true,
            "org_Id": "6",
            "parent": "1",
            "org_name": "偉景行科技有限公司",
            "org_num": "",
            "org_category": "公司",
            "description": ""
        },
        {
            "level": 2,
            "isLeaf": true,
            "expanded": false,
            "org_Id": "7",
            "parent": "6",
            "org_name": "新業務部",
            "org_num": "",
            "org_category": "部門",
            "description": ""
        },
        {
            "level": 2,
            "isLeaf": false,
            "expanded": true,
            "org_Id": "8",
            "parent": "6",
            "org_name": "數據中心",
            "org_num": "",
            "org_category": "部門",
            "description": ""
        },
        {
            "level": 3,
            "isLeaf": true,
            "expanded": false,
            "org_Id": "9",
            "parent": "8",
            "org_name": "項目一部",
            "org_num": "",
            "org_category": "部門",
            "description": ""
        },
        {
            "level": 3,
            "isLeaf": false,
            "expanded": true,
            "org_Id": "10",
            "parent": "8",
            "org_name": "項目二部",
            "org_num": "",
            "org_category": "部門",
            "description": ""
        },
        {
            "level": 4,
            "isLeaf": true,
            "expanded": false,
            "org_Id": "11",
            "parent": "10",
            "org_name": "智慧城市",
            "org_num": "",
            "org_category": "小組",
            "description": ""
        },
        {
            "level": 4,
            "isLeaf": true,
            "expanded": false,
            "org_Id": "12",
            "parent": "10",
            "org_name": "智慧旅游",
            "org_num": "",
            "org_category": "小組",
            "description": ""
        }
    ]
}
"level": 2, "isLeaf": false, "expanded": true,"parent": "10",  很重要,應該是缺一不可


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM