PDA

View Full Version : TreeNode - disabled config option vs node.disable()



hyankov
24 May 2007, 9:40 AM
Hi all.

I have the following situation - I create a tree where some of the tree nodes are initiated as disabled, through the config option when I create the tree node. After that operation, the disabled tree nodes are still clickable, which is what I actually wanted.

However, if I select a node and invoke its disable() method, I can't click the node any more... which is not ok for me :) How can I change this behavior? How do dynamically disable a node and can still be able to click it? I still need to have its disabled property set to true, because I use it in my logic. In other words - how do I disable a node, preserve all its disabled characteristics, but be able to click it?

Thanks.

hyankov
24 May 2007, 10:04 AM
Here is my solution:


if (selectedNode.disabled)
{
selectedNode.enable()
}
else
{
// Make sure we can click it later!
selectedNode.disabled = true;
selectedNode.ui.addClass("x-tree-node-disabled");
selectedNode.render();
}

This allows me to 'disable' the node and still be able to click it.

However, isn't this inconsistence in the behavior between config option 'disabled: true' and .disable() strange? The config option allows you to click the node, while after calling disable() you can't click it.