代码改变世界

jqGrid树

2018-06-13 14:11  sihao560  阅读(398)  评论(0编辑  收藏  举报
jQuery("#one_grid").jqGrid({  
               url:'/test.action',  
               datatype: "json",  
               width:300,  
               treeGrid: true,    
               treeGridModel: 'adjacency',    
               ExpandColumn : 'name',  
               colNames:['id','节点名称','结束日期', '节点层级','备注'],  
               colModel:[  
                    {name:'id',index:'id', hidden:true},  
                    {name:'name',index:'name', width:200,sortable:false},  
                    {name:'endDate',index:'endDate', width:70,sortable:false},  
                    {name:'nodeLevel',index:'nodeLevel', width:100,sortable:false},  
                    {name:'remark',index:'remark', width:80,sortable:false}  
                ] ,  
                pager: "false",  
                jsonReader: {    
                     root: "dataRows",    
                     repeatitems : false    
                },    
                treeReader : {    
                     level_field: "level",    
                     parent_id_field: "parent",    
                     leaf_field: "isLeaf",    
                     expanded_field: "expanded"    
                },  
                sortorder: "desc",  
                height: '100%'  
              });