1 Reply Latest reply on May 27, 2011 7:25 PM by dwagmuse

    togglePanel server-side events?

    dwagmuse

      I'm trying to use togglePanel to implement a multi-step wizard. I need to do some server-side processing after each step.

      Normally, I'd do that with an actionListener, but the documentation seems to suggest that I should instead use an itemChangeListener.

      However, the documentation doesn't quite explain how to do this, and I can't find any examples (the component showcase only demonstrates client-side controls).

      I tried attaching an actionListener to the commandButton that controls the toggleControl to switch panels, but that never gets called. An earlier discussion mentioned that the toggleControl overrides these default behaviors (that ought to be mentioned in the reference documentation!).

       

      What's the right way to do this?

        • 1. Re: togglePanel server-side events?
          dwagmuse

          I finally did find an example of how to use itemChangeListener in the showcase examples under menuPanel.

          Basically, togglePanel supports the itemChangeListener tag which works like actionListener except that it requires a different java method signature.

           

          in the view:

          <rich:togglePanel itemChangeListener="#{bean.next}" >

             <rich:togglePanelItem id="first" >

                ....

                  <h:commandButton value="Next..." >

                         <rich:toggleControl targetItem="@next" event="click" />

                  </h:commandButton>

             </rich:togglePanelItem>

           

           

          in the bean:

           

          public void next(ItemChangeEvent e) {

            if ("first".equals(e.getOldItemName()) {

              // do whatever servicing needs to happen after the first step of the wizard

            }

          }

           

          The last step of the wizard has to have a commandButton with a real action to go somwhere else INSTEAD OF a toggleControl.

          1 of 1 people found this helpful