3 Replies Latest reply on Aug 4, 2012 3:07 AM by selfcare

    rich:collapsiblePanel + rowClasses attribute

    selfcare

      Hi,

       

      Am using JSF 2.0, Rich Faces 4.0, Jboss As 6.0 (Tomcat 7).

       

      Am trying to display rich collapsible panel with alternative colours. Just like how it can be done using rowClasses attribute provided with h:dataTable.

       

      But, since that attribute doesnt come with rich:collapsiblePanel, how it can be achieved?

       

      I tried putting rich:collapsiblePanel inside h:dataTable with rowClasses but it didnt work.

       

      This is how I did,

       

       

       

      <h:dataTable  rowClasses="box1,box2" var="myVar" value="#{myBean.myList}">
      <h:column>

       

      <rich:collapsiblePanel header="#{myVar.myHeader}" expanded="#{myVar.expandedList}"
      switchType="server" leftCollapsedIcon="none"
      leftExpandedIcon="none" rightCollapsedIcon="none"
      rightExpandedIcon="none"
      onbeforeswitch="return setSelectedGenre(#{myVar.prg_gen_id});">

      </rich:collapsiblePanel>


      </h:column>
      </h:dataTable>


      .box1{
      background-color:#f4f4f4;
      padding:25px;
      }

      .box2 {
      background-color:#fdfdfd;
      padding:25px;
      }

       

       

      Regards,

        • 1. Re: rich:collapsiblePanel + rowClasses attribute
          selfcare

          Achieved through coding in the bean.

           

          Regards,

          • 2. Re: rich:collapsiblePanel + rowClasses attribute
            pel0s

            Hi!

             

            can you explain or tell us how did you do it? I have de same problem.

             

            Thx

            • 3. Re: rich:collapsiblePanel + rowClasses attribute
              selfcare

              Hi,

               

              Lets say panel with even numbers (2nd panel, 4th panel etc) to be display in Blue and panel with odd numbers to be displayed in Green.

               

              When the list is iterated, and panels are displayed, in the bean I will declare a string variable (lets say myColour) and assign it

              to Blue and Green respectively depending on if its even iteration or odd. Note  here that Blue and Green are just string variables in bean (like String myColour="Blue").

               

              styleClass for the panel is taken from bean like styleClass="#{myBean.myColour}. This will resolve to either Blue or Green value.

               

              In xhtml page, I have put CSS for myColour like,

               

              <style type="text/css">

                .Blue { whatever you want to do here...}

                .Green { whatever you want to do here...}

              </style?

               

              Hope it helps.

               

              Regards,