extjs 树 参考资料

Hide widget if not clicked on

You could do something like:

Ext.getBody().on('click', function(e){
    if (myPicker.isVisible() && !myPicker.getEl().contains(e.getTarget()){
        myPicker.hide();
    }
});


点击父节点 生成子节点
<script type="text/javascript">
Ext.onReady(function(){
Ext.BLANK_IMAGE_URL = "/PsoWeb/s_sgd/ext/resources/images/default/s.gif"
var Tree = Ext.tree;
var root=new Ext.tree.AsyncTreeNode({
id:"para=root",
text:"基本维度
});
var tree=new Tree.TreePanel({
renderTo:"tree-div",
root:root,
useArrows:true, 
    autoScroll:true, 
    animate:true, 
    enableDD:true, 
    containerScroll: true,
loader: new Ext.tree.TreeLoader({url:"treejsoncallback.jsp?para=root"})
});
tree.on("beforeload",function(node,event){
tree.loader.dataUrl='treejsoncallback.jsp?'+node.id;
});
});
</script>

http://finally-m.iteye.com/blog/537214

http://www.47school.com/Program/js/extjs/rmjc/2009/0623/28817.html

  Ext.onReady(function(){
       
        function test(node){
            var id=node.attributes.id;
            Ext.lib.Ajax.request(
                'POST',
                'griddata123.asp',
                id=node.attributes.id
                );
            if (node.item(0) == undefined) {
               
                    node.appendChild(new Ext.tree.AsyncTreeNode({
                        url:"griddata123.asp"
                    }))
               
            }
           
        }
        var root=new Ext.tree.AsyncTreeNode({
       
        id:"root",//id
       
        text:"树的根"//页面上显示的内容
       
       
        });
       
        var tree=new Ext.tree.TreePanel({
       
        renderTo:"tree",//相当于tree.render:doucment.body renderTo:document.body
       
        root:root,//定义根
        rootVisible:false,
        //autoScroll:true,//True表示为在面板body元素上,设置overflow:'auto'和出现滚动条 false表示为裁剪所有溢出的内容(默认为false)。
        autoWigth:true,//自动宽
        autoHeight:true,//自动高
        loader: new Ext.tree.TreeLoader({url:"column-data.asp"})//延时加载自定文件内容,需树
        });
        root.expand(true, true);//自动展开
        tree.on("click", function(node,e){
            if(node.isLeaf()){
                e.stopEvent();
                test(node);
                /**Ext.lib.Ajax.request(
                'POST',
                'griddata123.asp',
                id=node.attributes.id
                );*/
                }
        });
        });

Ext核心API详解-Ext.tree.TreePanel
http://www.cnblogs.com/fmxyw/archive/2009/07/15/1524019.html

你可能感兴趣的:(html,jsp,Ajax,ext,asp)