0 Replies Latest reply on Sep 26, 2007 3:20 PM by doballve

    a4j:outputPanel 3.1.0 documentation example issue(?)

      I need a TogglePanel/ToggleControl that perform an action when toggled. It also should act on a specific form region, so a4j region is used. According to documentation it should be possible to define action in rich:toggleControl, but didn't work in 3.1.0 (see http://jira.jboss.org/jira/browse/RF-1016).

      So, as a workaround, I checked the snippet bellow this from 3.1.0 documentation on a4j:outputPanel:

      <a4j:support .... reRender="mypanel"/>
      
      ...
      
      <a4j:outputPanel layout="none">
      
       <h:panelGrid id="mypanel" rendered="#{not empty foo.bar}">
      
       ...
      
       </h:panelGrid>
      
      </a4j:outputPanel>
      


      And tried to apply to my case:
      <a4j:region selfRendered="true">
       <a4j:outputPanel layout="none">
       <h:panelGroup id="mypanel1" rendered="#{panelTest.toggled}">
       <a4j:commandButton value="Toggle OFF" reRender="mypanel1,mypanel2"
       action="#{panelTest.setToggled(false)}"/>
       <f:verbatim>
       Toggle status: toggle is ON: showing mypanel1
       </f:verbatim>
       </h:panelGroup>
       </a4j:outputPanel>
      
       <a4j:outputPanel layout="none">
       <h:panelGroup id="mypanel2" rendered="#{!panelTest.toggled}">
       <a4j:commandButton value="Toggle ON" reRender="mypanel1,mypanel2"
       action="#{panelTest.setToggled(true)}"/>
       <f:verbatim>
       Toggle status: toggle is OFF: showing mypanel2
       </f:verbatim>
       </h:panelGroup>
       </a4j:outputPanel>
      </a4j:region>
      


      Note that the action is used to change the rendered condition for the panels (panelTest.toggled), which is initially false.

      The snippet above results in correct 1st rendering, but upon 1st 'Toggle ON' button click both panels are rendered - breaking the rendered condition logic.

      If I use 1 panel for ID and 1 panel for rendered, for each ouputPanel, like:
      ...
      <h:panelGroup id="mypanel2">
       <h:panelGroup rendered="#{!panelTest.toggled}">
      ...


      then I get past the 1st 'Toggle ON' button click correctly, only mypanel1 is displayed with 'Toggle OFF' button, but that AjaxCommandRendererBase.isSubmitted returns false (value not in paramMap).

      Bug or feature?

      Thanks,
      Diego