5 Replies Latest reply on Apr 7, 2011 5:06 AM by horrikhalid

    Strange behavior with a4j:commandLink and rich:tree

    horrikhalid

      Hello,

       

      After a long search in the forum I found my self with unsolvable problem.

      First let me explain what I have:

      In the jsf page I have two rich:tree component one for users and one for City/Quarter, rich:datatable and a4j:commandLink.

       

       

      <a4j:commandLink value="#{msg.save}" 
                     ajaxSingle="true" 
                     actionListener="#{assignmentBean.assignUserAction}" 
                     styleClass="button" 
                     reRender="userTree,tree,doctorsTable/>
      

       

       

      <rich:tree id="tree"  styleClass="tree1" nodeSelectListener="#{assignmentBean.nodeSelectListener}" stateAdvisor="#{treeAdvisor}"
                      reRender="selectedNode, tree,doctorsTable" ajaxSubmitSelection="true"  switchType="client"
                      value="#{assignmentBean.treeNode}" var="item" componentState="#{assignmentBean.treeState}"  ajaxSingle="true">
                      <rich:treeNode iconLeaf="../../img/leaf.png" icon="../../img/node.png">
                          <h:selectBooleanCheckbox  value="#{item.selected}" disabled="true"/>
                          <h:outputText  value="#{item.libelle}" />
                      </rich:treeNode>
                  </rich:tree>
      

       

       

      <rich:dataTable  id="doctorssTable" value="#{assignmentBean.doctorRelations}" var="userDoctorRelation" columnClasses="center" rows="100">
      
                       somethings here...  
      
      
                         <rich:column width="60" label="#{msg.potentiellabel}">
      
                              <h:selectOneMenu  id="potentiel" value="#{userDoctorRelation.potentiel.id}"  style="width: 50px;">
                              <t:selectItems value="#{assignmentBean.potentiels}" var="potentiel" itemLabel="#{potentiel.label}" itemValue="#{potentiel.id}"/>
                              </h:selectOneMenu> 
                          </rich:column>
      
      
      

       

      First Case :If I make the ajaxSingle="true"  in the commandLink the UserDoctorRelation object is not updated, So any change with selectOneMenu is not make any change in the model.

       

      Second Case : If I remove ajaxSingle from commandLink the model (UserDoctorRelation) is updated but the City/Quarter's nodeSelectListener is fired again, but no thing happen with users tree.

      In the RF documentation I found explaination about ajaxSignle:

       

      Limits JSF tree processing (decoding, conversion, validation and model updating) only to a component that 
      sends the request. Boolean. Default value is "false".
      

       

      Using the fireBug I can see that the selectOneMenu values are sent with the request, but the update phase are not happen for this values.

       

      I want just to update the model without fire the nodeSelectListener.

       

      Thnx in advance.

        • 1. Strange behavior with a4j:commandLink and rich:tree
          horrikhalid

          Some Hints:

          The nodeSelectListener fired because I use componentState="#{assignmentBean.treeState}", but I want to remember the tree's state without executing the nodeSelectListener

          • 2. Strange behavior with a4j:commandLink and rich:tree
            horrikhalid

            Please can any one explain me this why the nodeSelectListener is fired when using componentState?

            • 3. Re: Strange behavior with a4j:commandLink and rich:tree
              ilya_shaikovsky

              1) I'm not get the idea of the question about state and nodeSelection.. them should not be realted I think as you described.

               

              2) ajaxSingle=true means that only current component will be processed on decode/validate/updateModel phases. ignore that form information still sent. It's made in any way. We sending whole form but processing only needed parameters (according to regions, process attribute and ajaxSingle).

              • 4. Re: Strange behavior with a4j:commandLink and rich:tree
                horrikhalid

                Thnx for your reply Ilya , and let me explain to you what happen with nodeselectlistener and the state

                If I remove ajaxSingle from commandLink, the whole form will be processed on decode/validate/updateModel phases, that's OK, but the selectionListener also is fired,. look what the console display:

                 

                6 avr. 2011 12:47:51 org.exadel.jsf.PhaseTracker beforePhase
                INFO: BEFORE RESTORE_VIEW 1
                
                6 avr. 2011 12:47:51 org.exadel.jsf.PhaseTracker afterPhase
                INFO: AFTER RESTORE_VIEW 1
                6 avr. 2011 12:47:51 org.exadel.jsf.PhaseTracker beforePhase
                INFO: BEFORE APPLY_REQUEST_VALUES 2
                
                6 avr. 2011 12:47:52 org.exadel.jsf.PhaseTracker afterPhase
                INFO: AFTER APPLY_REQUEST_VALUES 2
                6 avr. 2011 12:47:52 org.exadel.jsf.PhaseTracker beforePhase
                INFO: BEFORE PROCESS_VALIDATIONS 3
                
                [2011-04-06 12:47:52,390] INFO  [ma.integradis.vmbackoffice.assignment.ui.assignmentBean] - ######### nodeSelectListener fired
                6 avr. 2011 12:47:52 org.exadel.jsf.PhaseTracker afterPhase
                INFO: AFTER PROCESS_VALIDATIONS 3
                6 avr. 2011 12:47:52 org.exadel.jsf.PhaseTracker beforePhase
                INFO: BEFORE UPDATE_MODEL_VALUES 4
                6 avr. 2011 12:47:52 org.exadel.jsf.PhaseTracker afterPhase
                INFO: AFTER UPDATE_MODEL_VALUES 4
                6 avr. 2011 12:47:52 org.exadel.jsf.PhaseTracker beforePhase
                INFO: BEFORE INVOKE_APPLICATION 5
                

                 

                Now If Iremove the state from the tree:

                 

                 

                6 avr. 2011 12:56:03 org.exadel.jsf.PhaseTracker beforePhase
                INFO: BEFORE RESTORE_VIEW 1
                6 avr. 2011 12:56:03 org.exadel.jsf.PhaseTracker afterPhase
                INFO: AFTER RESTORE_VIEW 1
                6 avr. 2011 12:56:03 org.exadel.jsf.PhaseTracker beforePhase
                INFO: BEFORE APPLY_REQUEST_VALUES 2
                6 avr. 2011 12:56:03 org.exadel.jsf.PhaseTracker afterPhase
                INFO: AFTER APPLY_REQUEST_VALUES 2
                6 avr. 2011 12:56:03 org.exadel.jsf.PhaseTracker beforePhase
                INFO: BEFORE PROCESS_VALIDATIONS 3
                
                6 avr. 2011 12:56:03 org.exadel.jsf.PhaseTracker afterPhase
                INFO: AFTER PROCESS_VALIDATIONS 3
                6 avr. 2011 12:56:03 org.exadel.jsf.PhaseTracker beforePhase
                INFO: BEFORE UPDATE_MODEL_VALUES 4
                6 avr. 2011 12:56:03 org.exadel.jsf.PhaseTracker afterPhase
                INFO: AFTER UPDATE_MODEL_VALUES 4
                6 avr. 2011 12:56:03 org.exadel.jsf.PhaseTracker beforePhase
                INFO: BEFORE INVOKE_APPLICATION 5
                

                 

                 

                I hope that I'll be clear as possible

                • 5. Re: Strange behavior with a4j:commandLink and rich:tree
                  horrikhalid

                  Any explaination?