Ext3动态树

var tree = new Ext.tree.TreePanel({
	id: 'dirTree',
	title: '目录树',
	width: 200,
        lines :false,
        rootVisible : false,
        loader: new Ext.tree.TreeLoader({
        	dataUrl: treeURL,
        	createNode : function(attr) {
			        if (this.applyLoader !== false) {
			            attr.loader = this;
			        }
			        var node = attr.defaulted ?
	                        new Ext.tree.TreeNode({text: attr.name, iconCls : attr.key, id: attr.id, allowDrop: !attr.defaulted}) :
		                        new Ext.tree.AsyncTreeNode({text: attr.name, iconCls : attr.key, id: attr.id, allowDrop: !attr.defaulted});
	                node.defaulted = attr.defaulted;
	                node.key = attr.key;
			        return node;
		    },
        	listeners :{
        		"beforeload": function(loader, node, callback) {
        			var parentId = node.id != "root" ? node.id : "";
        			loader.baseParams = {parentId: parentId, userId: userVO.id}
        		}
        	}
        }),
        root : new Ext.tree.AsyncTreeNode({text: '根目录', id:'root'})
    });

你可能感兴趣的:(ext)