1. #1
    Ext User
    Join Date
    May 2009
    Posts
    9
    Vote Rating
    0
    RaulDM is on a distinguished road

      0  

    Default How is it possible to attach a Event Listener with a TreeItem..??

    How is it possible to attach a Event Listener with a TreeItem..??


    Hello all

    I have created a Tree as:

    Tree tree = new Tree();
    tree.getStyle().setLeafIconStyle("icon-info");
    TreeBuilder.buildTree(tree, IrbModels.getTreeModel());


    But now I am unable to attach event Listener with the Tree Items which has no more child elements.

    Say my tree looks like


    --Main
    -------Portfolio
    -----------------Add Portfolio
    -----------------Modify Portfolio
    -----------------Delete Portfolio.


    Now I want to add Event Listeners with the TrreItems: Add Portfolio, Modify Portfolio, Delete Portfolio.

    I have tried to do this by:

    List<TreeItem> items = tree.getAllItems();
    TreeItem item;
    Iterator<TreeItem> t = items.iterator();
    while(t.hasNext()){
    item=t.next();
    if(item.hasChildren()){
    t.remove();
    }else{
    try{

    Listener<ComponentEvent> listener = new SelectionListener<ComponentEvent>(){
    @Override
    public void componentSelected(ComponentEvent ce) {
    TreeItem h = (TreeItem) ce.getSource();
    MessageBox.alert("abcd", h.getText()+" Item is clicked", null);
    }
    };
    tree.getItemById(item.getId()).addListener(new EventType(Event.ONCLICK), listener) ;
    }catch(Exception e){
    e.printStackTrace();
    e.getCause();
    e.getMessage();
    }
    }
    }

    But it does not working.

    I have tried the
    AddEventSunk() Method also with the el() component of the child nodes but then I got error message like;

    java.lang.AssertionError: Method must be called after the component is rendered
    at com.extjs.gxt.ui.client.widget.Component.assertAfterRender(Component.java:1286)
    at com.extjs.gxt.ui.client.widget.Component.el(Component.java:406)
    .......
    .......



    Does any One has any idea about this...

    Please show a way...!!

    It will be of great help



    Raul

  2. #2
    Ext User
    Join Date
    May 2009
    Posts
    9
    Vote Rating
    0
    RaulDM is on a distinguished road

      0  

    Default So i can't..right..??

    So i can't..right..??


    Cool I have done it..!!

    Thanks..!!

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