NetTalk Central

Author Topic: Table Cell Color -- Individual Cells  (Read 4113 times)

mpetitjean

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Nola Ridge
    • Email
Table Cell Color -- Individual Cells
« on: August 30, 2007, 05:32:55 AM »
      I want to be able to vary the background color of the cells in a table based on the value of one of the columns for that row in the data table.
I'm assuming this can be done through CSS.  To this end I followed Bruce's instructions, created a new .css file and moved the BrowseTable class into it.  See Below:

table.myBrowseTable {
  font-family: Tahoma, Verdana,  Arial, Helvetica, sans-serif;
  font-size: 11px;
  color: #333;
  margin: 5px 0px 5px;
  border-color: #888;
  border-top: 1px solid #888;
  border-left: 1px solid #888;
  border-bottom: 1px solid #888;
  border-right: 1px solid #888;
  padding: 0px;
}

table.myBrowseTable th {
  font-weight: bold;
  padding: 2px;
  border: 1px solid #AAA;
}

table.myBrowseTable td {
  padding: 2px;
  border: 1px solid #AAA;
  height: 20px;
}


    Next I added a new class call table.myBrowseTable green:

table.myBrowseTable green {
  background-color: green;
}

     The Class for the table is now 'myTableBrowse' in NetTalk.  I am using the Conditional tab on the filed and using the Class 'table.myTableBrowse green'.

     Even after Ctrl-F5 in the browser I do not see the background color in the cell.  However Firebug shows the html for this td as :

<td class="myBrowseTable green" width="15" title="Ashford, Larry From 8/29/2007 17:30 to 8/30/2007 1:30 Business flight">

      What am I doing wrong?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: Table Cell Color -- Individual Cells
« Reply #1 on: August 30, 2007, 06:52:22 AM »
Hi mike,

You're mixing up the nameing to much.

Firstly, you can't create
table.myBrowseTable green {
since gren is not an html tag.

In other words the
table.myBrowseTable td {
wasn't named arbitarily, it was specificly called
td because the html tag for cells is td.

the table. bit is really extra and shouldn't be used in your html. You'll notice the code referes to 'BrowseTable' not 'table.BrowseTable'

So in other words your class should be

.MyGreen {
background-color: green;
}

and then in the template set the class to
'myGreen'

Cheers
Bruce

mpetitjean

  • Newbie
  • *
  • Posts: 18
    • View Profile
    • Nola Ridge
    • Email
Re: Table Cell Color -- Individual Cells
« Reply #2 on: August 31, 2007, 03:46:28 AM »
     Thanks, Bruce, that worked!