Meinew
Meinew

Reputation: 514

Load specific icons in tree.Panel depending on node type

I am begining in Extjs and i would like to make a tree (with tree.Panel) which contents both file and folder. Moreover I would like to display specific icons for each type of node : a file must not have a folder child so the icon "create folder" which must only appear on folder nodes. I already have a tree with a boutton "delete" which exists for both types.

I presume I must listen for a event like "renderer" and ask for the type of my node and load the corresponding icon but I don't know how to do : the event comes from a different column that the tree column.

How can I get the node type (leaf:true/false) from the actionColumn which will content the icon?

Upvotes: 1

Views: 2480

Answers (1)

Sreek521
Sreek521

Reputation: 669

Please elaborate your question. If it is related to getting the node type(leaf or not) all you have to do is to add a renderer function to your column as below

              {
                    text: 'View in Filters',
                    flex: 2,
                    renderer: function (value, metaData, record) {
                      if(record.data.leaf){
                           //Do your stuff 
                         }
                       else {
                          //Do something else.
                           }
                    }

Or if it is related to showing different icons for parent and children check this once

http://stackoverflow.com/questions/17631880/extjs-treepanel-css-to-change-default-icons-node-and-leaf

Hope this helps...

Upvotes: 1

Related Questions