View Full Version : treegrid top-most parent row styling

9 May 2012, 1:52 PM
In this example: http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/tree/treegrid.html

35048 (http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/tree/treegrid.html)

9 May 2012, 3:47 PM
Unfortunately the current Tree implementation does not provide any unique classnames based on the depth. I recently implemented an extended version of Ext.tree.View for a client that added this functionality though I don't have access to the code. If I recall correctly the implementation was simply to override the collectData function and would add an additional rowCls based off the record.depth property. This allowed us to have differing background colors based off of the depth of the node within the tree.

9 May 2012, 5:20 PM
You could implement getRowClass() for your view to add a specific CSS classname for the row you wanted. Example:

Ext.create('Ext.tree.Panel', {
viewConfig: {
getRowClass: function(record){
return record.get('depth') > 1 ? '' : 'highlight';