There is two ways to display the sql data in DataTables. The first is to build out an html table with a loop. The second option is to use sAjaxsource.
Change the color of each <tr> with the first solution is trivial, as shown below:
<table>
<thead>
<tr>
<th>id</th>
<th>Customer Number</th>
<th>WCODE</th>
</tr>
</thead>
<tbody>
<?php while ($row = mysql_fetch_array($result)) :?>
<tr style="background-color:<?=$row['COLOR']?>;" >
<td ><?=$row['id']?></td>
<td ><?=$row['customer_number']?></td>
<td ><?=$row['WCODE']?></td>
</tr>
<? endwhile; ?>
</tbody>
</table>
as you can see, $row[‘COLOR’] is the color of each row.
I would like to accomplish the same results using the second option sAjaxsource. The <tbody> is empty and i cant control each tr. there is no tr.
any ideas?
thanks.
Use simple php, change:
in