关于Ext框架的树使用记录——页面对结点追加和移除
1、在官方API例子中观察得知,一颗tree的形成需要创建TreeStore(需要一个根节点root)、挂载树的容器Panel。
//官网demo
var store = Ext.create('Ext.data.TreeStore', {
root: {
expanded: true,
children: [
{ text: 'detention', leaf: true },
{ text: 'homework', expanded: true, children: [
{ text: 'book report', leaf: true },
{ text: 'algebra', leaf: true}
] },
{ text: 'buy lottery tickets', leaf: true }
]
}
});
Ext.create('Ext.tree.Panel', {
title: 'Simple Tree',
width: 200,
height: 150,
store: store,
rootVisible: false,
renderTo: Ext.getBody()
});
2、创建一个Panel,并且item使用treepanel,生成tree的根节点
Ext.create('Ext.Panel', {
width: 500,
height: 300,