1. #1
    Ext User
    Join Date
    Apr 2010
    Posts
    1
    Vote Rating
    1
    simonob007 is on a distinguished road

      1  

    Question Tree Panel Icon Overlays

    Tree Panel Icon Overlays


    Hi All

    I am trying to figure out how to add overlay icons to existing icons in a tree panel.

    I currently have a tree panel and have set an icon provider that will change the icon of each tree node based on the model data that supports each tree node.

    I would like to be able to overlay another icon (a transparent gif with an exclamation mark) if the tree node model data has a property that identifies the node as important.

    I know that I could duplicate all of my icons and provide an important version of all of them however this seems like a 'hack' especially as I have hundreds of different icons that can be displayed in my tree and it would seem far more sensible to have a single transparent 'important' icon and just overlay this on top.

    Has anyone done anything like this before or could anyone offer and suggestions where I should start trying to do this?

    Many Thanks

    Simon

  2. #2
    Sencha User f.sauter's Avatar
    Join Date
    Jul 2009
    Location
    Germany
    Posts
    32
    Vote Rating
    0
    f.sauter is on a distinguished road

      0  

    Default


    Hi, you can change the icon element like this:

    PHP Code:

    BaseTreeModel model 
    myTree.getSelectionModel().getSelectedItem()
    //findNode is protected so write ur own class with a method which calls findNode, in my case findNodeForModel
    Element iconElement myTree.getTree().getView().getIconElement(myTree.findNodeForModel(selectedItem));
    iconElement.getStyle().clearProperty("background");
    iconElement.getStyle().setBackgroundImage("url(myimagepath)");
    //iconElement.getParentNode().... 
    So here is the point where u can add your own nodes or change styles. Hope this helps.

  3. #3
    Ext Premium Member
    Join Date
    May 2010
    Posts
    21
    Vote Rating
    0
    DanWhite is on a distinguished road

      0  

    Default


    Hi,

    Did anyone figure out a way to do this? Contextual icons are something I would quite like to have, but if possible I would like to avoid generating the full set of each icon combined with each individual overlay.

    Dan

Thread Participants: 2