2 Replies Latest reply on Nov 8, 2007 4:29 PM by Jeff Jo

    Last row in < rich:tree > not updatable

    Jeff Jo Newbie

      I have a tree which contains <h:inputText/> elements on the leaf nodes. When I enter text into the input text components and press my "Done" link, everything updates as expected. However, the last leaf in the tree does not update. The value being submitted is correct (debugged through PhaseListener), but the value never gets applied to the model. Anyone have any ideas?

      A simplified version of my code:

      <h:form id="formid">
      <rich:tree id="scheduleTree" switchType="client" preserveModel="none" immediate="false">
       <rich:treeNodesAdaptor id="datesLevel" nodes="#{statusSheetController.scheduleNodes}" var="treeDates">
       <rich:treeNode>
       <h:outputText value="#{treeDates.meetingDate}"/>
       </rich:treeNode>
       <rich:treeNodesAdaptor id="eventsLevel" nodes="#{treeDates.events}" var="treeEvents">
       <rich:treeNode>
       <h:outputText value="#{treeEvents.startDate}">
       <f:convertDateTime pattern="hh:mm a"
       timeZone="#{timeZoneHelper.currentTimeZone}" />
      
       </h:outputText>
       <h:outputText value=" - "/>
       <h:outputText value="#{treeEvents.endDate}">
       <f:convertDateTime pattern="hh:mm a"
       timeZone="#{timeZoneHelper.currentTimeZone}" />
       </h:outputText>
       <h:outputText value=" #{treeEvents.meetingSession.title}"/>
      
       </rich:treeNode>
       <rich:treeNodesAdaptor id="abstractsLevel" nodes="#{treeEvents.abstracts}" var="treeAbstracts">
       <rich:treeNode>
       <h:panelGrid columns="5" border="1" styleClass="width100Percent" columnClasses="width15Percent,width20Percent,width30Percent,width30Percent,width5Percent textAlignRight">
       <h:inputText size="2" value="#{treeAbstracts.paperNumber}" maxlength="4"/>
       <a4j:commandLink actionListener="#{statusSheetController.doneEditAbstractLink}" reRender="scheduleTree">
       <h:outputText value="Done"/>
       </a4j:commandLink>
       </h:panelGrid>
       </rich:treeNode>
       </rich:treeNodesAdaptor>
       </rich:treeNodesAdaptor>
       </rich:treeNodesAdaptor>
      </rich:tree>
      
      
      </h:form>
      
      


        • 1. Re: Last row in < rich:tree > not updatable
          Jeff Jo Newbie

          Update:

          After some more debugging, this is what I found

          When the value for the last leaf node is being submitted, the following happens during the lifecycle:

          -----------------------------------------------
          After Restore View (1):
          Submitted value is correct
          Value is null
          isLocalValueSet is false

          After Apply Request Values (2)
          Submitted value is correct
          Value is null
          isLocalValueSet is false

          After Process Validations (3)
          Submitted Value is correct
          Value is still null
          isLocalValueSet is false

          -------------------------------------------

          When I press Done on a non-last-leaf node, the Value of the component gets set after process validations, unlike what we see above:

          After Process Validations (3)
          Submitted Value is null
          Value is set and correct
          isLocalValueSet is true


          I've also found that this anomoly happens if there are tree levels after the last leaf node that do not have leaves in them. For example:

          -Level One 1
            -Level Two 1
          -Level One 2
            -Level Two 1
            -Level Two 2 (Won't get updated properly)
          -Level One 3
          -Level One 4

          Notice Level One 3 and Level One 4 have no leaf nodes under them. If I populate them with leaf nodes, however, then the last leaf node (which would be under Level One 4) is updated correctly. Anyone have any ideas?

          • 2. Re: Last row in < rich:tree > not updatable
            Jeff Jo Newbie

            Resolution:

            I had to wrap the whole thing in an a4j:region and then instead of binding to #{treeAbstracts.paperNumber}, I had to bind it to a bean in my controller. So weird.