6 Replies Latest reply on Oct 14, 2011 9:23 AM by u j

    Expanded attribute of rich:collapsiblePanel

    elisei Newbie

      Hi everyone,

       

      I have a small problem with the expanded attribute of rich:collapsiblePanel. If I bind that attribute to a viewscoped bean, like this:

       

       

      expanded="#{mybean.expandedBooleanFlag}"
      

       

      The initial status is set correctly. However, when I expand or collapse the panel the new value is not stored in the bean property.

       

      I tried using all three switchTypes (server, ajax, client) and used a submit-Button in my form. But in no case, the new value was stored in the property.

       

      Could you give me a hint about what I am doing wrong?

       

      Thanks,

       

      Elisei

        • 1. Re: Expanded attribute of rich:collapsiblePanel
          Dirk Reske Newbie

          Hello,

           

          the same here with panelMenuGroup (RichFaces 4)

          Tried all suggestions from the internet.

          The groupMode on panelMenu (or mode on panelMenuGroup) is set to server or ajax (tried all).

          Neither the action, the changeExpandListener is fired nor the expanded value is written back to the bean.

           

          <h:form>
            <rich:panelMenu itemMode="ajax" groupMode="ajax" activeItem="#{navigation.model.selectedChild}">
              <rich:panelMenuGroup label="#{label.navAccessRight}"
                                   expanded="#{navigation.model.menuState['accessright']}"
                                   changeExpandListener="#{navigation.groupSelected('accessright')}">
          

           

          Hope, somebody can help!

          • 2. Re: Expanded attribute of rich:collapsiblePanel
            elisei Newbie

            Have you tried bindind the component to an object in the bean and then try to read the expanded property there?

            • 3. Re: Expanded attribute of rich:collapsiblePanel
              elisei Newbie

              Is there any possibillity to trigger an ajax event when the panel is expanded or the header clicked?

              • 4. Re: Expanded attribute of rich:collapsiblePanel
                u j Novice

                If it still helps you, I did it like this:

                point the toggleListener attribute to a bean method with parameter PanelToggleEvent. In the method, use event.getExpanded() to set the value to a boolean bean field. Bind the field to the expanded attribute.

                 

                That works fine if the page is reloaded.

                 

                However, if the panel is ajax-updated by another action, the expanded attribute is not re-evaluated (although I changed it on the server-side) and the panel does not change state.

                 

                My switch type is ajax.

                 

                Regards

                • 5. Re: Expanded attribute of rich:collapsiblePanel
                  u j Novice

                  I made a write-up of the problem:

                   

                  If a rich:collapsiblePanel is rerendered via ajax, the expanded attribute is not re-evaluated.

                   

                  <rich:collapsiblePanel  toggleListener="#{bean.toggle}"

                  expanded="#{bean.open}" switchType="ajax"

                  onswitch="#{bean.render ? 'load();' : ''} >

                   

                  The bean.render method is called, the open method is not (verified with the debugger).

                  So e.g. the panel is opened by click, some other action changes the (session) bean property open to false and then an action ajax-rerenders the panel, the panel is still open instead of closed.

                  Only on a page GET reload is the panel closed.

                   

                  RichFaces 4.0.0.final

                   

                  Should I file a bug?