/*
* Ext JS Library 2.0.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
/*----------------------------------------------------------*/
var myNode;
var myFNode;
function createTree(){
var Tree = Ext.tree;
var tree = new Tree.TreePanel({
el:'tree-div',
autoScroll:true,
animate:true,
containerScroll: true,
rootVisible: true,
// checkModel: 'cascade', //对树的级联多选
// onlyLeafCheckable: false,//对树所有结点都可选
// animate: false,
loader: new Tree.TreeLoader({
})
});
var root = new Tree.AsyncTreeNode({
iconCls: 'folder',
text: 'china',
draggable: false,
id : '0'
});
//var orderby =new Ext.tree.TreeSorter(tree,{folderSort:true,dir : "asc",property :"order"});
//new Ext.tree.TreeSorter(tree, {folderSort:false});
tree.setRootNode(root);
// tree.on('click', function(node){node.toggle();});
tree.on('beforeload', function(node) {
tree.loader.dataUrl = 'tree.txt'; //后台获取的数据
myNode=node;
myFNode=node.parentNode;
rootNode=root;
});
tree.on('click',
function(node)
{
alert(node.text);
}
);
tree.render();
root.expand();
}
/*----------------------------------------------------------*/
Ext.onReady(function(){
createTree();
});
posted on 2010-08-27 14:57
孤飞燕 阅读(289)
评论(0) 编辑 收藏 所属分类:
Ext