3 Replies Latest reply on Apr 29, 2009 2:03 PM by Nick Belaevski

    How to know which panelBarItem I'm on?

    Thai Dang Vu Apprentice

      This is my xhtml

      <rich:panelBar height="400" width="500" binding="#{index.panelBar}">
       <a4j:support event="onitemchange" action="#{index.changePanelBarItem}" ajaxSingle="true"/>
       <rich:panelBarItem label="..." name="...">...</rich:panelBarItem>
       <rich:panelBarItem label="..." name="...">...</rich:panelBarItem>
       <rich:panelBarItem label="..." name="...">...</rich:panelBarItem>
      </rich:panelBar>


      On the server side:
      public void changePanelBarItem() {
       System.out.println(panelBar.getSelectedPanel());
      }

      I realize that on the server I get the name of the panel bar item that the user leaves from, not the one he is going to.

      In order to get the panel bar item the user is going to, I use:
      <rich:panelBar height="400" width="500" binding="#{index.panelBar}">
       <a4j:support event="onitemchange" action="#{index.doNothing}" ajaxSingle="true" oncomplete="changePanelBarItem();"/>
       <rich:panelBarItem label="..." name="...">...</rich:panelBarItem>
       <rich:panelBarItem label="..." name="...">...</rich:panelBarItem>
       <rich:panelBarItem label="..." name="...">...</rich:panelBarItem>
      </rich:panelBar>
      <a4j:jsFunction action="#{index.changePanelBarItem}" name="changePanelBarItem"/>


      Is there any better way than that?