1 Reply Latest reply on Sep 21, 2007 10:30 AM by nayan j

    problem updating rich:tree using a:support actionListener

    nayan j Newbie


      I have created a rich:tree. Each rich:treeNode contains a h:checkbox. I have added a:support to the checkbox. When the user clicks a checkbox, actionListener method runs and updates the subtree data model on server. The problem is the UI does not update the checkboxes in subtree unless user clicks on treenodes again to collapse or expand the subtree.. Please tell me what is wrong in following code:

      <rich:tree id="tree" switchType="ajax" style="width:300px" value="#{library.data}"
       var="item" nodeFace="#{item.type}" showConnectingLines="false"
       binding="#{dataSourceTree}" componentState="#{library.treeState}">
       <rich:treeNode id="leafNode" type="leaf" iconLeaf="img/blank.gif" nodeClass="checkbox">
       <h:selectBooleanCheckbox id="serviceCheckbox" value="#{item.selected}" styleClass="checkbox">
       <a:support event="onclick" ajaxSingle="true" actionListener="#{item.setSelected}" RequestDelay="3" reRender="tree" immediate="true"/>
       <h:outputText id="leafText" value="#{item.name}" />
       <rich:treeNode id="categoryNode" type="leafCategory" icon="img/blank.gif" nodeClass="checkbox">
       <h:selectBooleanCheckbox id="categoryCheckbox" value="#{item.selected}" styleClass="checkbox">
       <a:support event="onclick" actionListener="#{item.setSelected}" RequestDelay="3" reRender="tree" immediate="true"/>
       <h:outputText id="categoryText" value="#{item.name}" />

        • 1. Re: problem updating rich:tree using a:support actionListene
          nayan j Newbie

          Forgot to mention that I am using richfaces 3.0.1 with Seam 1.2.1GA

          It seems to that when an event is fired through a:suppor inside a checkbox, the reRender attribute does not update the UI. Clicking on the tree collapse and expand button or doing a page refresh redisplays the tree with nodes properly checked. Is there any way to force refresh of a:region?

          It will also be nice if someone can explain why is there a difference in the events fired through a:support and tree collapse... I ran the code through a debugger and it seems that when event is fired via a:support.. Apply Request Values phase is executed but update Model values phase is not executed. Tree expand/collapse runs the update Model values phase, leading to reRendering of tree as desired. Is this difference intentional or a bug? or am I need to use rich:tree in a different manner? Please help this is really important.