extjs的treestore

treestore的定义

sumTypeTree: {
    type: 'tree',
    rootVisible: true,
    //defaultRootProperty:'awardTotal',
    root: {
        expanded: true,
        text: 'All',
    },
    proxy: {
        type:'ajax',
        url : 'sumType/index',
        extraParams:{tree:true},
        reader: {
            type: 'json',
        }
    },
},
 treestore需要有一个root属性,所有数据都从root开始,proxy取到的数据附加到root的 children上
defaultRootProperty可以修改默认的 children属性
Ext.data.NodeInterface定义了treemodel特有的属性
text 文本
leaf 是否叶子结点
 
treestore的节点可以是单纯的treemodel,也可以是treemodel和model的联合体,这时候需要为treestore指定model属性
root节点在treelist组件中是始终不显示的,在treepanel组件中可以可以设置是否显示

猜你喜欢

转载自haohetao.iteye.com/blog/2395796