4 Replies Latest reply on Feb 19, 2009 12:16 PM by Lotfi Mellouk

    [rich:tree]: how to populate children on node selection even

    Lotfi Mellouk Master

      Hi,

      yet another question that concern tree, Id like to add children on node selection because it takes a long time to calculate all nodes on the beginin.

      I tried to use processSelection, but, I cannot get the selected object,

      you use on richfaces demo

      public void processSelection(NodeSelectedEvent event) {
      
       HtmlTree tree = (HtmlTree) event.getComponent();
      }

      this code throws a classCast exception, I got HtmlTree parent component but I dont fin how I can recover the selected item. should I use a4j:support?
      here a snippet JSF code:

      <rich:tree style="width:400px" value="#{bean.data}"
      var="item" nodeFace="#{item.type}" switchType="ajax" ajaxSubmitSelection="true">
      <rich:treeNode type="company">
      <h:outputText value="#{item.name}" />
      </rich:treeNode>
      <rich:treeNode type="user" icon="./images/singer.gif" iconLeaf="./images/singer.gif"
      nodeSelectListener="#{bean.processUserSelection}" data="#{item}">
      <h:outputText value="#{item.firstname} #{item.lastname}" />
      </rich:treeNode>
      <rich:treeNode type="access">
      <h:outputText value="#{item.login}" />
      </rich:treeNode>
      </rich:tree>
      


      Hope it's clear enough.
      regards!