2 Replies Latest reply on Jan 23, 2013 12:19 AM by Rick Lu

    Event when clicking a tree node - RF4 tree

    Rick Lu Newbie

      I am using RF4.

      TreeSelectionChangeEvent won't be invoked if clicking on a already seleted node.

       

      Is there a event will be invoked all the time.

      Something like "onClick", I tried it but with no luck. 

       

      I am also not sure about how to get the selected node from ActionEvent.

       

      Thanks

       

       

      <h:form id="formTree">

       

       

                                    <rich:tree id="tree" value="#{treeTabBean.root}" var="node"

                                              nodeType="#{node.type}" toggleType="client"

                                                        onClick="selectNode();Event.stop(event);"

                                              rowKeyConverter="org.richfaces.IntegerSequenceRowKeyConverter"

                                              selectionType="ajax" render="showSelected, tabsWrapper">

       

       

                                              <rich:treeNode type="leaf"           onClick="selectNode();">

                                                        <h:outputText value="#{node}" />

                                              </rich:treeNode>

       

       

                                              <rich:treeNode type="branch">

                                                        <h:outputText value="#{node}" />

                                              </rich:treeNode>

       

       

                                    </rich:tree>

                                    <a4j:jsFunction id="selectode" render="tabsWrapper"

                                              name="selectNode" actionListener="#{treeTabBean.clickChanged}">

                                    </a4j:jsFunction>

       

       

                                    <a4j:outputPanel id="showSelected" layout="block">

                                              <h:outputText value="#{treeTabBean.selected}" rendered="#{true}" />

                                    </a4j:outputPanel>

                          </h:form>

       

       

       

      public void clickChanged(ActionEvent event) {

       

                          log.info("-clickChanged:: ******** start");

                          UITree tree = (UITree) event.getComponent();

                          selected = (TreeElement<String>) tree.getRowData();

       

      ......

       

                          }

                }