EXTJS系列笔记————treepanel的显示

页面:

Ext.define("AHS.main.MainLeftView",{
extend:"Ext.tree.Panel",
xtype:"mainleftview",

store:Ext.create('test.main.MainLeftStore'),
columns:[
    {
    xtype:'treecolumn',
    dataIndex:'description',
    flex:1
    }
    ]
})

store中的代码:

Ext.define('test.main.MainLeftStore', {
    extend: 'Ext.data.TreeStore',
    proxy: {
         type: 'ajax',
         url: 'loadTree.json'
    },
    reader : {
          type : 'json'
    },
    root: {
         expanded: true,
id: '0',
description:"根节点"
    }
});


返回的json字符串,其中description是附加属性,其他都是自带属性

[ {"id":"300","parentId":"0","description":"报表","leaf":false,"expanded":true,"children":[
{"id":"301","parentId":"300","description":"蓝单报表","leaf":true},
{"id":"302","parentId":"300","description":"FCCB报表","leaf":true},
{"id":"303","parentId":"300","description":"ALHR报表","leaf":true}]
},
{"id":"400","parentId":"0","description":"系统管理","leaf":false,"expanded":true,"children":[
{"id":"401","parentId":"400","description":"部署","leaf":true},
{"id":"402","parentId":"400","description":"配置基础页面","leaf":true},
{"id":"403","parentId":"400","description":"配置定义页面","leaf":true}]
}]




猜你喜欢

转载自blog.csdn.net/java_dotar_01/article/details/79261379