extTree

extTree

function tree3(){
    var root=new Ext.tree.TreeNode({
      id:"root",
      href:"http://www.easyjf.com",
       hrefTarget:"_blank",
      text:"树的根"});
    var c1=new Ext.tree.TreeNode({
      id:"c1",
      href:"http://www.easyjf.com",
       hrefTarget:"_blank",
      text:"一级子节点1"
      });
    var c2=new Ext.tree.TreeNode({
      id:"c2",
      href:"http://www.easyjf.com",
       hrefTarget:"_blank",
      text:"一级子节点2"
      });
    var c3=new Ext.tree.TreeNode({
      id:"c3",
      href:"http://www.easyjf.com",
       hrefTarget:"_blank",
      text:"二级子节点1"
      });
    var c4=new Ext.tree.TreeNode({
      id:"c4",
      href:"http://www.easyjf.com",
       hrefTarget:"_blank",
      text:"二级子节点2"
      });
    root.appendChild(c1);
    root.appendChild(c2);
    c1.appendChild(c3);
    c2.appendChild(c4);
    var tree=new Ext.tree.TreePanel({
      renderTo:"hello",
      root:root,
      width:200
      });
    root.on("click",function(node,event){
      alert("您点击了"+node.text);
              }
          );
    c1.on("click",function(node,event){
      alert("您点击了"+node.text);
            }
     );
    c2.on("click",function(node,event){
      alert("您点击了"+node.text);
            }
     );
    c3.on("click",function(node,event){
      alert("您点击了"+node.text);
            }
     );
    c4.on("click",function(node,event){
      alert("您点击了"+node.text);
            }
     );    
   }

你可能感兴趣的:(extTree)