PDA

View Full Version : problem with disabling treenode



tubamanu
3 Sep 2009, 12:44 AM
Hi there,

i'm having a TreePanel and a TreeNode. To my TreeNode, i append Childs from a Json Store.

My Problem is, that i need to set userrights to the TreeNode using disabled : true/false.
But i only get all TreeNodes disabled or all TreeNodes enabled. Depends on the state of the last TreeNode i will add. What am I doing wrong ?



var tree = new Ext.tree.TreePanel({
frame: false,
width: 230,ext
animate: true,
enableDD: true,
bodyStyle:'padding:5px;',
rootVisible: false,
border: false,
expanded: true,
id: theJsonTreeData.result[a].usermodule.id
});
var root = new Ext.tree.TreeNode({
text: 'root',
expanded: true
});

for (var b=0;b<theJsonTreeData.result[a].usermodule.usergroup.length;b++) {
var myTreeItem = theJsonTreeData.result[a].usermodule.usergroup[b];

root.appendChild({
leaf: true,
id: myTreeItem.object,
disabled: myTreeItem.disabled,
iconCls: myTreeItem.icon,
text: myTreeItem.translation,
listeners: {
click: {
fn:function(node,value) {
cf.Navigation.handleClick(node);
}
}
}
});
}

tree.setRootNode(root);