users@woodstock.java.net

Re: Problem with custom css class for table column

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Tue, 27 May 2008 12:10:22 -0400

Here are a couple examples of how to override table selectors.

<style type="text/css">
<!-- Example of how CSS selectors can be overridden. -->
.MyTbl table.Tbl_sun4 td { border:none }
.MyTbl table.Tbl_sun4 th { border:none }

<!-- Example of how to define custom CSS selectors -->
table.Tbl_sun4 tr.rowColor1 td, table.Tbl_sun4 tr.rowColor1 th {
background-color: #880000; }
table.Tbl_sun4 tr.rowColor2 td, table.Tbl_sun4 tr.rowColor2 th {
background-color: #008800; }
</style>

<!-- Messages -->
<webuijsf:messageGroup showSummary="true" showDetail="true"/>
<webuijsf:markup tag="br" singleton="true"/>

<!-- Style Class -->
<webuijsf:table id="table1" title="Style Class"
    style="left: 100px; position: relative" styleClass="MyTbl" width="300">
  <webuijsf:tableRowGroup id="rowGroup1" styleClasses="rowColor1, rowColor2"
      sourceData="#{TestBean.groupB.names}" sourceVar="name">
    <webuijsf:tableColumn id="col1"
        alignKey="last" headerText="Last Name" rowHeader="true">
      <webuijsf:staticText text="#{name.value.last}"/>
    </webuijsf:tableColumn>
    <webuijsf:tableColumn id="col2" alignKey="first" headerText="First
Name">
      <webuijsf:staticText text="#{name.value.first}"/>
    </webuijsf:tableColumn>
  </webuijsf:tableRowGroup>
</webuijsf:table>

Felipe Jaekel wrote:
> I have a custom class that changes the table column background color.
>
> When the page renders the class attribute looks like this:
>
> class="outroMes TblTdLyt_sun4"
>
>
> It seems that TblTdLyt_sun4 overrides the background color with white.
>
> Using the style property works, but class would be much better.
>
> Is there any workaround?
>
> Thanks,
> Felipe
>
>