Results 1 to 4 of 4

Thread: Is it possible to change tree icon when i click on it?

  1. #1
    Sencha User
    Join Date
    May 2011
    Posts
    14
    Vote Rating
    0
      0  

    Default Unanswered: Is it possible to change tree icon when i click on it?

    is it any way to change the tree icon when i click on it. i use GXT 2.X.

    Appreciate for any suggestion.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Answers
    109
    Vote Rating
    93
      0  

    Default

    Moved to the GXT 2 forums, since it is about GXT 2.

    How are you defining the icons for the items already? Listen for the click, modify the data so that the icon changes, and then tell the store that the data has been changed so the item must be redrawn.

  3. #3
    Sencha User
    Join Date
    May 2011
    Posts
    14
    Vote Rating
    0
      0  

    Default

    Code:
            Tree.setIconProvider(new ModelIconProvider<Data>(){
            public AbstractImagePrototype getIcon(Data model){
                     if (model.hasChildren){
                            return  IconHelper.createPath("./a.gif");
                     }else{
                           return  IconHelper.createPath("./b.gif");
                      }
            }
    Thank you. I wrote something like these for the tree iron. How can i tell the store to redraw the tree? or you means i need to rebuilt the entire tree again?

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,737
    Answers
    109
    Vote Rating
    93
      0  

    Default

    Just like you would to change the text of an item in the tree, or values in a grid (liststore in that case), make the change in the model so that hasChildren is true, and run store.update(model). This notifies any data widgets that are listening that the model passed in has changed, and should be redrawn.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •