Topic: Assign CSS to Table Cells

Hello Folks,
i'm new here so please be patient with me :-) im Using Xajax for our Club website and im trying to do somthing like a markable Table. The Table has even rows colored white and uneven rows colored green. Its a for for loop drawing the rows. If the counter $i is uneven the variable $styleAdd = 'Style="background-color:#CCFFCC"'; else its empty. The last cell stays white because there is an clicable Icon. Now i want to mark that row with Xajax, The Function colorMeRed returns $objResponse -> assign($nodeId, "backgroundColor", "#ffb6c1"); But the green cells staying green only the white cells are getting red. Has someone a suggestion?

Thank You!

<tr Style="background-color:#FFFFFF; cursor: pointer;" id="row_<?= $rowNumber ?>">
                  <td class="text bBright" <?= $styleAdd ?>>
                    <span onclick="xajax_colorMeRed('row_<?= $rowNumber ?>' );">&nbsp;<?= $rowNumber ?>&nbsp;</span>
                  </td>
                  <td class="text bBright" <?= $styleAdd ?>>
                    <?=$rowVName ?>
                  </td>
                  <td class="text bBright" <?= $styleAdd ?>>
                    <?=$rowVDate ?>
                  </td>
                  <td style="cursor: pointer;" class="bBright" onclick="showPDF(<?= $pdfShow ?>);"><img title="" src="/images/pdf.gif"></td>
                </tr>

Re: Assign CSS to Table Cells

Hello CruzCampo and welcome ;-)

an easier way is to write two css classes.
.active{}
.inactive{}

$objResponse -> assign($nodeId, "className", "active");


concrete in your case try the following

$objResponse -> assign($nodeId, "style.backgroundColor", "#ffb6c1")   // The style is attached

does it helps?

Re: Assign CSS to Table Cells

Hello Romacron,
thank you for the advice. I finally made it your way. just wrote two css classes with different bg-color values and the response Obj. is changing them!

Thank You!

Re: Assign CSS to Table Cells

I strongly believe that tables should only be used for taubular data.

Using tables to structure a page creates maddening maintenance problems while CSS is so much cleaner and simple.

Just my opinion. smile

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.