1. #1
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    5
    Vote Rating
    0
    doughboy is on a distinguished road

      0  

    Default Answered: Custom icons in tree Model

    Answered: Custom icons in tree Model


    In 2.5, the documentation about the method TreePanel.getStyle().setNodeOpenIcon is:
    Sets the global icon style for expanded tree items (defaults to 'tree-folder-open'). Individual tree items can override this value by setting the the item's icon style.
    I'm looking all over the place but can't find a way to change my individual items icons. All my items in the tree are extending (BaseTreeModel). I assume I'm not extending (or) implementing the good classe.

    Can someone shed some light on this?

  2. You should use the iconprovider.

    Code:
            tree.setIconProvider(new ModelIconProvider<ModelData>() {
                @Override
                public AbstractImagePrototype getIcon(ModelData model) {
                    // return your icon
                }
            });

  3. #2
    Sencha - GXT Dev Team
    Join Date
    Nov 2010
    Posts
    209
    Answers
    4
    Vote Rating
    -2
    Ersmarker has a little shameless behaviour in the past

      0  

    Default


    You should use the iconprovider.

    Code:
            tree.setIconProvider(new ModelIconProvider<ModelData>() {
                @Override
                public AbstractImagePrototype getIcon(ModelData model) {
                    // return your icon
                }
            });

  4. #3
    Sencha Premium Member
    Join Date
    Mar 2012
    Posts
    5
    Vote Rating
    0
    doughboy is on a distinguished road

      0  

    Default Solved!

    Solved!


    Thanks Ersmarker,

    I use the ClientBundle to ge the icons.

    Here's my code:

    Code:
    		tree.setIconProvider(new ModelIconProvider<ModelData>() {
    			@Override
    			public AbstractImagePrototype getIcon(ModelData model) {
    				return AbstractImagePrototype.create(Resources.ICONS.add());
    			}
    		});

Thread Participants: 1

Tags for this Thread