1. #1
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    361
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Question GXT 3.0 Tree - How to display custom icon per tree node?

    GXT 3.0 Tree - How to display custom icon per tree node?


    I need to display a multi-level tree and show various icons per tree node. In the demo examples all I see are images set at the root tree level, i.e. one TreeStyle for the entire tree. How can I display different icons at each of the tree nodes/levels?

  2. #2
    Ext GWT Premium Member
    Join Date
    Jun 2011
    Posts
    9
    Vote Rating
    0
    dierp is on a distinguished road

      0  

    Default


    Looks like you need to implement an IconProvider and pass it to the Tree.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    45
    Vote Rating
    0
    raivis is on a distinguished road

      0  

    Default


    Code:
            tree.setIconProvider(new IconProvider<SideMenuDto>() {
    
    
                @Override
                public ImageResource getIcon(SideMenuDto p_model) {
                    return  .... // your icon choosing algorithm
                }
            });
    where SideMenuDto is my tree item object. Use your own in your case.

  4. #4
    Ext GWT Premium Member
    Join Date
    Jan 2009
    Location
    Colorado Springs, CO
    Posts
    361
    Vote Rating
    5
    DavidHoffer is on a distinguished road

      0  

    Default


    Yeah that works perfectly, plus I found I can dynamically update the icons which is what I need to do by calling refresh on the tree. Thanks.

  5. #5
    Sencha User
    Join Date
    Dec 2012
    Posts
    17
    Vote Rating
    0
    Kathie is on a distinguished road

      0  

    Default


    Digging out an old thread.

    I managed to use IconProvider to display a different icon for various tree nodes. Is there a way to set a different open and close icon for the various tree nodes type?

  6. #6
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,639
    Vote Rating
    80
    Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice Colin Alworth is just really nice

      0  

    Default


    The open and close nodes are governed by one of two things:
    * First, check to see if a TreeStyles object was set via setStyle
    * Second, use the appearance instance that the tree was given

  7. #7
    Sencha Premium Member
    Join Date
    Oct 2013
    Posts
    11
    Vote Rating
    0
    hellotech is on a distinguished road

      0  

    Default


    Currently I can only use either TreeStyle to display the nodes icons with either open/close or use IconProvider to display them with my different node types. So you are saying if I want to combine the two, I have to use TreeAppearance?

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar