7 Replies Latest reply on Dec 19, 2009 10:55 AM by Matthias Nott

    dynamic tree and nodeSelectListener

    Smitha Ramaswamy Newbie

      I have a dynamic tree that is retrieving the node text from the database and it works perfectly fine in displaying the parent node and children.
      I am using rich:tree, rich:recursiveTreeNodesAdaptor, rich:treeNode.
      Now I am trying to get the feature of clicking the leafnode to open up the corresponding link. I am trying to use the nodeSelectionListener to implement this feature
      and I see that it is not working in seam implementation. It never calls the node processing method in the bean.

      I did couple of tests:

      1. I tried to use different switchtype and ajaxSubmitSelection option, it did not work.

      2. I tried to use simple rich:tree to get the nodeSelectionListener work outside seam framework, it works.

       <rich:tree style="width:300px" nodeSelectListener="#{simpleTreeBean.processSelection}" 

      3. I tried invoking the app in different browser it still doesn't call the nodeSelectListener implementation.

      Any help on getting this work will be appreaciate. I was reading in forum at one of the thread were the problem was similar but I did not see any answer.
      Any alternate solution to get this working.


      Here is my code:

      <rich:tree switchType="client" nodeSelectListener="#{configurationTreeManager.processSelection}"
                          reRender="selectedNode" ajaxSubmitSelection="true">
           <rich:recursiveTreeNodesAdaptor id="config" roots="#{configurationTreeManager.rootNodes}" 
                     <h:outputText value="#{config.configuration.nodeText}"/>

      public class ConfigurationTreeManager {                
           public void processSelection(final NodeSelectedEvent event) {
                final HtmlTree tree = (HtmlTree) event.getComponent();
                nodeTitle = (String) tree.getRowData();
                final TreeNode currentNode = tree.getTreeNode(tree.getRowKey());
                if (currentNode.isLeaf()) {
                     System.out.println("current tree node is a leaf");
                } else {
                     System.out.println("current tree node is not a leaf");