View Full Version : Treepanel and folder icon

2 Mar 2007, 3:32 AM

I've got a question for you :

I have a tree panel which work fine ( thanks Jack!:D ) but it still a little problem.

I set an icon to a node with cls and it's OK. The problem is when its node has a child, the icon become the folder icon. I don't want it. I'de like to keep my custom icin, even if the node has a child.

Is there a way to do it or not?

Thanks for your response.

2 Mar 2007, 5:02 AM
That is because the node gets the 'folder' class per default if it has or gets childnodes.

You can offcourse change the folder class in the stylesheet, or you can override the updateExpandIcon function to change the behaviour as you want it.

Good luck!

2 Mar 2007, 5:04 AM
$nodes[] = array('text' =>'foo', id=>'bar', cls=>'folder'), change it to your class in your backend

2 Mar 2007, 7:38 AM
OK Thanks.

How can i overwrite this method. Can you write an example please?


2 Mar 2007, 8:09 AM
"cls": "message"
to your Json

This will over ride the icon for both open and closed node.

.message .x-tree-node-icon {
background-position: 64px 0px;

Note the above css uses a sprite image for all of the tree icons for performance. If yours is just a single gif you don't need the bckground-position,

If you wanted to use a different icon for the default expanded I used this:

.x-tree-node-expanded .x-tree-node-icon {
background-position: 128px 0px;