Change color of in datatable depends the color from database
Change color of in datatable depends the color from database

There is two ways to display the sql data in Data Tables ( jQuery ), one is fetch the data with loop, and the other is to use sAjaxsource . if i`m using the first option,i can change the color of each tr . for example
id
Customer Number
WCODE
<?php
while ($row = mysql_fetch_array($result)) {
?>
<?=$row['id']?>
as you can see, $row['COLOR'] is the color of each row.
By using some features i need to use the second option, sAjaxsource.
so everything is ok, and the data is on the screen. but how i can get to each row and set the background color as i did in the first option? because in the code the tbody is empty and i cant control each tr. there is no tr.
any ideas? thanks.
id
Customer Number
WCODE
<?php
while ($row = mysql_fetch_array($result)) {
?>
<?=$row['id']?>
as you can see, $row['COLOR'] is the color of each row.
By using some features i need to use the second option, sAjaxsource.
so everything is ok, and the data is on the screen. but how i can get to each row and set the background color as i did in the first option? because in the code the tbody is empty and i cant control each tr. there is no tr.
any ideas? thanks.
This discussion has been closed.