1 Reply Latest reply on Dec 8, 2007 1:05 PM by Florian Marwede

    RichFaces and CSS

    Alberto Molteni Newbie

      Hi all!

      First a general issue: when I customize the richFaces elements like dataTable, dataScroller and so on, which is the default behaviour? Is it a good practice to override the styles defined for the components or is it better to work only with the attributes styleClass, headerClass and so on of the element itself?
      I think that the second one is the best choice, but I could not find anything on the web explaining which is the best practice in this case.

      Second, a more specific problem. I'm trying using the styleClass attributes to render a table in this way:

      <rich:dataTable id="configTable" value="#{categoryBean.selectedCategory.mailConfigTs}" var="configuration" headerClass="richTableHeader"
       rowClasses="tableRowEven, tableRowOdd">
       <f:facet name="header">
       <rich:columnGroup headerClass="richTableHeader">
       <rich:column colspan="2"><h:outputText value="Configurazioni disponibili per #{categoryBean.selectedCategory.catDesc}" /></rich:column>
       <rich:column breakBefore="true"><h:outputText value="Indirizzo Email" /></rich:column>
       <rich:column><h:outputText value="Rimuovi" /></rich:column>

      in this case headers are NOT rendered as I want, since my Class richTableHeader is set correctly to the table row (tr), but is overridden in the table cell (td) by .dr-table-headercell..

      Thus, is there a way to set a class at cell level or I MUST override the defaul css styles for the dataTable?

      Thanks very much in advance

        • 1. Re: RichFaces and CSS
          Florian Marwede Expert

          Buona sera!

          (Suppongo tu sei italiano. Mi dispiace, continuo a scrivere in inglese.)

          Questions on that topic are asked very often. So please read the concerning sections in the developer guide and search in this forum for similar threads to get a basic understanding. You also get some valueable expert answers already given.

          First: How you customize styles depends on what you want. For example overriding the predefined RF style classes is the best choice if you wanna change the style of all instances of a component (for example dataTable) in a project. If you wanna change the style of a single datatable, you use the styleClass, headerClass and so on attributes (plus some other possibilities).
          You see there are some basic rules and normally that is everything you have to know.
          But I also remember the following: a RF user stated some time ago, that customizing is not working like documented. After a long and exhausting discussion an expert from staff found out, that some configurations in the web.xml were wrong.
          What I wanna say: Styling is normally easy but seldom it can be a little bit tricky - as always when you use JSF component technology.

          Second: On first glance I notice that you use the headerClass attribute in the columnGroup component. In my opinion that's wrong.

          Hope it helps!