PDA

View Full Version : Remove Tree Node leaf icon



jej2003
26 Oct 2011, 9:05 AM
Is it possible to remove a tree nodes icon? Setting the iconCls to x-tree-noicon used to work in 3.x, is there something equivalent that can be done with 4.x?

skirtle
26 Oct 2011, 9:43 PM
I don't believe there's a CSS class built in but you can craft one pretty easily. From the title of your post I assume you want to remove icons for all leaf nodes? For that you could do something like this:


Ext.create('Ext.tree.Panel', {
cls: 'no-leaf-icons',
...
});


.no-leaf-icons .x-tree-icon-leaf {
visibility: hidden;
width: 2px; /* Adjust width to suit */
}

or alternatively:


.no-leaf-icons .x-tree-icon-leaf {
display: none !important;
}

If you want to target individual nodes then the technique is much the same. In that case you'd add an iconCls to the node and then specify one of the CSS blocks above using that class as the selector.