有两处需要注意"---级联选中"
selectTree = new Ext.tree.TreePanel({
checkModel: 'cascade',---级联选中
border : false,
id : 'ext-tree',
autoScroll : true,
anchor : '100% 100%',
width : 200,
animate : true,
frame : false,
// autoHeight :true,
enableDD : false,
containerScroll : true,
rootVisible : false,
root : new Ext.tree.AsyncTreeNode({
text : '根',
draggable : false,
id : Global.Config.dept.root
}),
loader : new Ext.tree.TreeLoader({
dataUrl : 你的数据源'
})
});
---级联选中
selectTree.on('checkchange', function(node, checked){
node.attributes.checked = checked;
node.expand();
node.eachChild(function(child){
child.ui.toggleCheck(checked);
child.attributes.checked = checked;
child.fireEvent('checkchange', child, checked);
});
}, selectTree);
selectTree.on(
'beforeload',
function(node){
loading = new Ext.LoadMask(Ext.get(treeWin.getEl()), { msg: "正在加载数据,请等待..." });
loading.show();
}, selectTree);
selectTree.on(
'load',
function(node){
node.eachChild(function(child){
if(child.leaf&&child.departPriviType=='enable'){
child.ui.toggleCheck(true);
child.attributes.checked = true;
child.attributes.checked = false;
}
});
loading.hide();
}, selectTree);
treeWin.add(selectTree);
treeWin.show();