View Full Version : Change style of the node selected in TreePanel

6 Sep 2011, 1:55 PM
Ext.define('menu.lista', {

extend: 'Ext.tree.Panel',


listeners: {
selectionchange: function(elemento, item){



Clicking on a Node TreePanel, it must change the CSS, the style, bold, for example.

Does anyone have any suggestions?


7 Sep 2011, 1:04 AM
You can add your own css class to the selected items in a treepanel like this:

xtype : "treepanel",
viewConfig : {
selectedItemCls : "test"

.test { color : "yellow" }

but you should note that the default css from extjs is now overriden

8 Sep 2011, 1:30 AM
To avoid overriding the built-in class you could put the CSS class to the whole tree instead.

Ext.create('Ext.tree.TreePanel', {
cls: 'custom',

.custom .x-grid-row-selected .x-grid-cell {
font-weight: bold;

Figuring out how to craft a suitable selector is just a couple of minutes investigation in Firebug.

12 Sep 2011, 1:46 PM
@skirtle Tks Man. This is very Helpful!