How to change background color of a tree node after clicking on it.
I am having a treepanel and loading tree nodes through loader. While rendering tree nodes, I am assigning default style to each and every tree nodes. Now, I want to change the background color dynamically of another tree nodes on click on a treenode.
How can I do that?
Please help.
RE: How to change background color of a tree node after clicking on it.
Add css to cls property.
Code:
myNode.Cls = "NodeCss2"
where NodeCss:
/* entire node */
.NodeCss1 {background-color: yellow;}
/* only text */
.NodeCss2 a span{background-color: yellow;}
-----------------
Don't work. I have not noticed this: "...after clicking on it.". Sorry
RE: How to change background color of a tree node after clicking on it.
So works :)
JavaScript function example:
Code:
...
function nodeSelected(node) {
var pnode = node.parentNode;
var nnode = new Ext.tree.AsyncTreeNode(
{
text: node.text,
id: node.id,
leaf: node.leaf,
allowDrop: node.attributes.allowDrop,
icon: node.attributes.icon,
cls: 'NodeCss2',
qtip: node.attributes.qtip,
YourAttr: node.attributes.YourAttr
});
pnode.replaceChild(nnode, node);
}
...
what are you passing node as parameter?
what are you passing node as parameter?