/*//創(chuàng)建Tree面板組件
var _tree = new Ext.tree.TreePanel({
//title : '簡(jiǎn)單的樹(shù)面板示例',
region:'west',
autowidth : true,
autoheight : true,
//applyTo : 'hello',
border:false,
root : root
});*/
//創(chuàng)建根節(jié)點(diǎn)
var root = new Ext.tree.TreeNode({
text : '根節(jié)點(diǎn)' ,
expanded: true //此處展開(kāi)所有。
});
//為根節(jié)點(diǎn)添加子節(jié)點(diǎn)
var a1 = root.appendChild( new Ext.tree.TreeNode({
text : '一級(jí)子節(jié)點(diǎn)A1'
}))
var b1 = root.appendChild( new Ext.tree.TreeNode({
text : '一級(jí)子節(jié)點(diǎn)B1'
}))
var c1 = root.appendChild( new Ext.tree.TreeNode({
text : '一級(jí)子節(jié)點(diǎn)C1'
}))
var d1 = root.appendChild( new Ext.tree.TreeNode({
text : '百度' ,
href: 'http://www.baidu.com' ,
hrefTarget: '_blank'
}))
//--------二級(jí)節(jié)點(diǎn)----------------------------
var a21 = a1.appendChild( new Ext.tree.TreeNode({
text: '二級(jí)節(jié)點(diǎn)A21'
}))
var a22 = a1.appendChild( new Ext.tree.TreeNode({
text: '二級(jí)節(jié)點(diǎn)A22'
}))
var a23 = a1.appendChild( new Ext.tree.TreeNode({
text: '二級(jí)節(jié)點(diǎn)A23'
}))
var b21 = b1.appendChild( new Ext.tree.TreeNode({
text: '二級(jí)節(jié)點(diǎn)B21'
}))
var b22 = b1.appendChild( new Ext.tree.TreeNode({
text: '二級(jí)節(jié)點(diǎn)B22'
}))
var c21 = c1.appendChild( new Ext.tree.TreeNode({
text: '二級(jí)節(jié)點(diǎn)C21'
}))
//--------三級(jí)節(jié)點(diǎn)-------------------------------
var a31 = a21.appendChild( new Ext.tree.TreeNode({
text: '三級(jí)節(jié)點(diǎn)A31'
}))
var a32 = a21.appendChild( new Ext.tree.TreeNode({
text: '三級(jí)節(jié)點(diǎn)A31'
}))
var b31 = b21.appendChild( new Ext.tree.TreeNode({
text: '三級(jí)節(jié)點(diǎn)B31'
}))
//---------四級(jí)節(jié)點(diǎn)--------------------------------
var a41 = a31.appendChild( new Ext.tree.TreeNode({
text: '四 級(jí)節(jié)點(diǎn)A41'
}))
|