PDA

View Full Version : Async tree - make empty nodes appear as "nodes", not "leaves"



mdmitry
20 Feb 2010, 8:49 AM
Hello,

I'm using TreePanel "dataUrl" parameter to load nodes asynchronously. I want a node without children not to show a [+] icon, without expanding it first. So I pass in JSON "expanded":true and "children":[] for empty nodes. The problem is that they show up as leaves ("file" icon), and I want them to show as nodes ("folder" icon). They start looking "as I wish" if I drag'n'drop another node into it, then drag it back away. Is there a proper (and simple) way to make an empty node have a "folder" icon?

Thanks.

mdmitry
24 Feb 2010, 5:47 AM
bump

wm003
26 Feb 2010, 1:59 AM
Give each node/child the attribute


iconCls: 'icon_folder'

where you would use a css class like


.icon_folder {
/* using the original folder-icon from extjs */
background-image:url(../images/default/tree/folder.gif)
}

mdmitry
1 Mar 2010, 6:17 PM
I've figured it out, needed to add to a node

cls: 'x-tree-node-collapsed'