1 Reply Latest reply on May 15, 2013 9:30 AM by alsha

    RF4: rich:tree selectionChangeListener does not work

    alsha

      Hi *,

       

      selectionChangeListener - attribute in rich:tree has no effect for me.

       

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <html xmlns="http://www.w3.org/1999/xhtml" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"
        xmlns:h="http://java.sun.com/jsf/html" xml:lang="en" lang="en">
      <h:head></h:head>
      
      <h:body>
        <a4j:log hotkey="M" mode="popup" />
        <h:form>
          <rich:tree var="item" selectionChangeListener="#{testBean.selectionChangeListener}">
            <rich:treeModelRecursiveAdaptor roots="#{testBean.roots}" nodes="#{item.children}">
              <rich:treeNode>
                <h:outputText value="#{item.name}" />
              </rich:treeNode>
            </rich:treeModelRecursiveAdaptor>
          </rich:tree>
        </h:form>
      
      </h:body>
      
      </html>
      

       

       

       

      public class TestBean {
          
          public List<Map<String, Object>> getRoots () {
              List<Map<String, Object>> roots = new ArrayList<Map<String, Object>>();
              Map<String, Object> n1 = new HashMap<String, Object>();
              n1.put("name", "Node 1");
              Map<String, Object> n1_1 = new HashMap<String, Object>();
              n1_1.put("name", "Node 1_1");
              
              List<Map<String, Object>> children = new ArrayList<Map<String, Object>>();
              children.add(n1_1);
              n1.put("children", children);
              
              roots.add(n1);
              return roots;
          } 
          
          public void selectionChangeListener(TreeSelectionChangeEvent event) {
              Collection<Object> newSelection = event.getNewSelection();
          }
      }
      

       

       

      TestBean.selectionChangeListener(..) is never called. Tested with RF4.3.1.Final and RF4.3.2.CR1.

       

      Any help would be appreciated,

       

      Alexey

        • 1. Re: RF4: rich:tree selectionChangeListener does not work
          alsha

          very strange:

           

          if i replace

           

          <h:outputText value="#{item.name}" />
          

           

          with

           

          <a4j:commandLink value="#{item.name}" />
          

           

          then TestBean.selectionChangeListener(..) is getting invoked, but only if i click exactly on link (tree selection is also changed, if clicking on folder-icon, but this does not ajax call).