PDA

View Full Version : [SOLVED] Tree's selected node's style



darthwes
21 Apr 2010, 11:38 AM
I've got a tree with say 3 nodes. Each one is a simple node, just a title and an id. On click, I grab the id from the node and pop up a simple window.

The way the tree works, out of the box, is when you select a node, that node has it's style changed to have a light blue background to "feel" selected for the user.

The 'problem' I'm having is that since I'm using a treenode to act like a link, I'd like to get rid of that behavior without a CSS massacre. When I inspect the elements I see that there is a div that I didn't define that is being used to toggle the background colors, but because I didn't create that div, I'm not sure how to attack that.

Am I missing something obvious? Is there documentation discussing this somewhere? Any assistance would be much appreciated.

A solution (not the best) :



tree.on('click', function(n) {
if(n.leaf){
var myUI = n.getUI();
var closed = function() {
return function() {
myUI.removeClass('x-tree-selected');
myUI.addClass('x-tree-unselected');
myUI.addClass('DEADBEEF-FEEBDAED');
};
}();
setTimeout(closed, 250);
}