3 Replies Latest reply on May 21, 2007 5:47 AM by hasc

    Question on rendering a @Datamodel

    hasc

      Hello,

      Is there a way to set the styleClass of a <h:dataTable> for a special row when a @Datamodel is rendered?

      In my case some objects that the Set contains, can be special and i want to render them in a row as:

      <tr class="special">


      I wrote a method in the objects class

      public boolean isSpecial() {
       // return true or false
      }
      


      is there a way i can realize that?

      Thanks for help,
      hasc

        • 1. Re: Question on rendering a @Datamodel
          straubp

          Maybe like this:

          <h:dataTable value="#{...}" var="row" rowClasses="#{row.special ? 'special' : ''}">
          ...
          </h:dataTable>
          


          • 2. Re: Question on rendering a @Datamodel
            hasc

            thanks, but this did not work.

            i tried

            #{item.special ? 'parent' : 'child'}


            which renderes all rows with class="child"



            • 3. Re: Question on rendering a @Datamodel
              hasc

              i found a possible solution but this seems a little ugly to me.

              i wrote a method

              public String getRowClasses {

              }

              which loops over the Set and generates a comma seperated list with the class names depending on the special property of each object.

              so:
              rowClasses="#{budgetOverview.rowClasses}

              if theres a better solution tell me please.

              regards,
              hasc