PDA

View Full Version : TreeNode leaf issues



Darklight
19 Apr 2007, 1:47 AM
I have some issues creating empty Nodes that i want to show as folders instead of an empty leaf. I've tried the solution found here (http://www.extjs.com/forum/showthread.php?t=2454&highlight=treenode+leaf+folder), but it doesn't seem to do the trick.
I'm creating an empty node like this:

NewNode = new Tree.TreeNode( {
text: "Text",
id: "NodeID",
children: [],
expanded: true,
allowChildren: true
});
and i want it to show up as an empty folder. This all happens after the onReady event (at the click of a button).
Any help on this appreciated!

Animal
19 Apr 2007, 2:06 AM
The solution is here: http://www.extjs.com/forum/showthread.php?t=4342&page=2

Darklight
19 Apr 2007, 11:50 AM
just adding iconCls: 'folder' to the config doesnt work, do i have to do something else? alter the css file?

Animal
19 Apr 2007, 4:32 PM
Yes. See the thread.

Darklight
20 Apr 2007, 12:07 AM
thanks for your help so far Animal!
i have added this to ext-all.css:

.x-tree-node img.folder, .x-tree-node-collapsed img.folder{
background-image:url(../images/default/tree/folder.gif);
}
.x-tree-node-expanded img.folder {
background-image:url(../images/default/tree/folder-open.gif);
}
and changed

.x-tree-node-collapsed .x-tree-node-icon, .x-tree-node-expanded .x-tree-node-icon, .x-tree-node-leaf .x-tree-node-icon{
to this

.x-tree-node .x-tree-node-icon, .x-tree-node-collapsed .x-tree-node-icon, .x-tree-node-expanded .x-tree-node-icon, .x-tree-node-leaf .x-tree-node-icon{

, but this

NewNode = new Tree.TreeNode( {
text: 'Title',
iconCls: 'folder'
});
still doesn't add the folder icon :(
i just used
icon: '/ext/resources/images/default/tree/folder.gif' for now.

another question though, is it then possible to add children to this node after it has been created?