View Full Version : Setting TreeNode.uiProvider Causes RootVisible to be Ignored

22 Jul 2010, 4:48 PM
I'm trying to extend TreeNodeUI with my own class and then set TreeNode.uiProvider to use my custom class. Only problem is when I set TreeNode.uiProvider with my class or even with Ext.tree.TreeNodeUI it causes the TreePanel to display the root node even though rootVisible is set to false in the TreePanel config.

Is this a bug. Are there any workarounds?

To reproduce set rootVisible to false on a TreePanel and set uiProvider to Ext.tree.TreeNodeUI on your TreeNode config. Expected result rootnode is invisible, actual result root node is visible.

23 Jul 2010, 1:55 AM
turns out there is a little snippet inside the setRootNode method of TreePanel that was the culprit.

setRootNode : function(node){
........... bunch of code .............
var uiP = node.attributes.uiProvider;
node.ui = uiP ? new uiP(node) : new Ext.tree.RootTreeNodeUI(node);
......... more code ..................

So I ended up extending TreePanel and overriding the setRoot method so it always uses Ext.tree.RootTreeNodeUI.

Hanni Sullivan
12 May 2011, 6:52 AM
Hi Bergstyle,

this was quite helpful. The root node is finally invisible thanks to your hint.

16 Dec 2013, 7:23 PM
You do not need to override TreePanel.setRootNode method, if you want root node invisible, you can add attr "uiProvider: Ext.tree.RootTreeNodeUI" to your root node cfg, then your rootVisible cfg will effect as usual.