PDA

View Full Version : Change color of selected node



hieu79vn
13 Apr 2012, 6:42 AM
Hello,

When users click on a node, I would like to make the node text in bold and in red. Could you tell me how I can do it?

Thank you

scottmartin
13 Apr 2012, 10:03 AM
See if this works for you:



.x-grid-cell-selected {
background-color: #FF0000 !important;
color:white;
}


Regards,
Scott.

hieu79vn
16 Apr 2012, 12:18 AM
Hi Scott,

I don't find a property of child node/panel to assigne this css. How can you do it?

Thank you

hieu79vn
16 Apr 2012, 1:03 AM
hi Scott,

I'm successful in assigning the cls by
var node = Ext.get(item.children[0].children[0]);
node.addCls('x-grid-cell-selected');
but
i must remove this css when user click on other items, so I do like this

beforedeselect:function ( rowModel, record, index){

var node = treePanel.getNodeById(index);
nodes.removeCls('x-grid-cell-selected');
},

but it raises error because we cannot put index as input for getNodebyId. Do you other function to get a node or html element from rowModel/ record/ index so that i can remove the cls of the previous selected node?
Thank you

scottmartin
16 Apr 2012, 5:44 AM
I was under the impression you were using a gridPanel. I see in your latest code you are using a treepanel. I will take another look.

Scott.

scottmartin
17 Apr 2012, 7:14 PM
Please use:



.x-grid-row-selected .x-grid-cell, .x-grid-row-selected .x-grid-rowwrap-div {
color: white;
background-color: red !important;
}


Scott.

hieu79vn
17 Apr 2012, 11:14 PM
Thank you Scott