Search code examples
treeoracle-adf

actionListner on Link in Tree in ADF is not getting invoked first time


I am working with ADF and I have a tree structure with all the nodes as link. On each click link should invoke the actionListner.

But whenever I click Tree node first time, method does not getting invoked. then on second time it is invoked. It happens with all the nodes of Tree.

I surfed a lot. I could not get appropriate solutions.

So many places suggestions are like :

  Use Immediate property with True value. which is already present in my code.
  Use partialSubmit with link. This is also already done.
  Convert link into Buttons. Tried. But the same problem remains with it.
  Replaced actionListner with action. But again same problem persists.

But I put link outside Tree and checked. It's invoking on first click too. But inside tree it's not invoking.

FYR the code is :

  af:tree id="dtlTree" summary="Project Main Tree Structure"
                 value="#{pageFlowScope.generalPageHandler.model}" rowSelection="single" var="node" immediate="true"
                 binding="#{pageFlowScope.generalPageHandler.mainTreeBinding}" contentDelivery="whenAvailable"
                 initiallyExpanded="true">
         <f:facet name="nodeStamp">
          <af:group id="g1">
           <af:image source="/images/process.png" id="i1" shortDesc=" "/>
           <af:link text="#{node.text}"  immediate="true"
                    actionListener="#{pageFlowScope.generalPageHandler.treeSelectionActionListener}"
                    inlineStyle="font-weight:bold; color:Blue;" id="cil1" partialSubmit="true"/>
          </af:group>
         </f:facet>
        </af:tree>

Solution

  • I figured out that I need to include selectionListner event with my tree in ADF. As soon as I add selectionListner with the Tree. It will help me to focus on the selected node.

    As soon as my selected node gets focus then it will navigate to the actionListner.

    So by adding selectionListner to the tree helped me to resolve the issue what I was facing.

    The changes done in the code is :

            <af:tree id="dtlTree" 
                     summary="Project Main Tree Structure"
                     value="#{pageFlowScope.generalPageHandler.model}" 
                     rowSelection="single" 
                     var="node" 
                     immediate="true"
                     binding="#{pageFlowScope.generalPageHandler.mainTreeBinding}" 
                     contentDelivery="immediate"
                     initiallyExpanded="true" 
                     selectionListener="#{pageFlowScope.generalPageHandler.treeSelectionListner}">
    
                     <f:facet name="nodeStamp">
                        <af:group id="g1">
                            <af:image source="/images/process.png" id="i1" shortDesc=" "/>
                                <af:link text="#{node.text}"  immediate="true"
                                    actionListener="#{pageFlowScope.generalPageHandler.treeSelectionActionListener}"
                                    inlineStyle="font-weight:bold; color:Blue;" id="cil1" partialSubmit="true"/>
                        </af:group>
                    </f:facet>
            </af:tree>