I am using a Dijit Tree, and I need to change the CSS style for a node when selected (focus). Lets imagine a node is black when "deselected", and it becames red when "selected" and viceversa.
What should I change in my code?
var tree = new Tree({
model: this._model,
showRoot: true,
autoExpand: true,
persist: false,
getLabel: function (item) {
return item.name;
},
onClick: function (item, node, event) {
businessLogic.goToView(item.id);
}
If you want to update the css for the selected node, you should just override the css like this:
.claro .dijitTreeRowSelected {
color: red
}
Here is a simple jsfiddle which will make the selected label red, and the hovered one green:
http://jsfiddle.net/edchat/dox42qye/15/