[CLOSED] TreePanel With Image/Icon

  1. #1

    [CLOSED] TreePanel With Image/Icon

    Hi,

    I see your tree component column example: https://examples2.ext.net/#/TreePane...ponent_Column/

    And I want to perform something similar, I attach an image of what I mean.
    This is a simple treepanel with an image next to treenode if this node accomplish a condition.

    Is there a way to do it, or the only way is to make the same as the example but with an image column and a renderer for example.

    Click image for larger version. 

Name:	treeWithImage.png 
Views:	30 
Size:	67.3 KB 
ID:	6371
    Last edited by Daniil; Jun 17, 2013 at 7:42 AM. Reason: [CLOSED]
  2. #2
    Hi @softmachine2011,

    Please see the "NEW" images right from the nodes' text.
    http://mvc.ext.net/

    This is how we implemented it.

    ColumnModel =
    {
        Columns =
        {
            new TreeColumn()
            {
                Flex = 1,
                Renderer =
                {
                    Fn = "treeRenderer"
                }   
            }
        }
    }
    var treeRenderer = function (value, metadata, record) {
        value = record.data.text; // It looks an ExtJS bug - value is undefined.
    
        if (record.data.isNew) {
            value += "<span>&nbsp;</span>";
        }
        
        return value;
    };
  3. #3
    Quote Originally Posted by Daniil View Post
    value = record.data.text; // It looks an ExtJS bug - value is undefined.
    It just needs to set up DataIndex.

    new TreeColumn()
    {
        DataIndex = "text",
        Flex = 1,
        Renderer =
        {
            Fn = "treeRenderer"
        }   
    }
    var treeRenderer = function (value, metadata, record) {
        if (record.data.isNew) {
            value += "<span>&nbsp;</span>";
        }
        
        return value;
    };
    Also you might need to set up
    HideHeaders = true
    for a TreePanel.
  4. #4
    I done it like you told me and it works perfectly!

    Thanks

Similar Threads

  1. Replies: 0
    Last Post: Jun 20, 2011, 5:13 PM
  2. [CLOSED] Using an external image as the icon of a button
    By Pablo_Azevedo in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 08, 2010, 1:03 PM
  3. [CLOSED] Add an image as icon
    By Sharon in forum 1.x Legacy Premium Help
    Replies: 9
    Last Post: Apr 29, 2010, 10:00 AM
  4. Replies: 1
    Last Post: Jun 02, 2009, 12:23 PM
  5. [CLOSED] Image/Icon column in grid
    By jchau in forum 1.x Help
    Replies: 2
    Last Post: Mar 26, 2009, 3:46 PM

Tags for this Thread

Posting Permissions