A example of treepanel of Ext

var root = new Ext.tree.TreeNode({
                 id:"root",
                 text:"Sample"
            });
        var ITDep = new Ext.tree.TreeNode({id:"c1",text:"IT Dep",href:"http://www.sina.com",hrefTarget:"_blank",leaf:false});
        var HRDep = new Ext.tree.TreeNode({id:"c2",text:"HR Dep",leaf:false});
        root.appendChild(ITDep);
        root.appendChild(HRDep);
        ITDep.appendChild(new Ext.tree.TreeNode({id:"c3",text:"Leo",leaf:true}));
        ITDep.appendChild(new Ext.tree.TreeNode({id:"c4",text:"Tom",leaf:true}));
        ITDep.appendChild(new Ext.tree.TreeNode({id:"c5",text:"Ray",leaf:true}));
        HRDep.appendChild(new Ext.tree.TreeNode({id:"c6",text:"Sarah",leaf:true}));
        var tree = new Ext.tree.TreePanel({
            renderTo:"hello",
            root: root,
            width:100
            });
        tree.on("click",function(node,event){
              alert("click on "+node.text);
            });

 

你可能感兴趣的:(ext)