⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How to change td color



elfuego1
  • profile picture
  • Member

Posted 01 February 2013 - 22:53 PM

Hi,

How can I change cell (td) color based on value from database?
If there is 0 in table cell then td color should be red and if cell value is 1 then td background color should be green.

Can anyone tell me how it can be done?

Best regards.
Tom.

victor
  • profile picture
  • Member

Posted 02 February 2013 - 00:14 AM

Hi elfuego1 and welcome to the forum!
you can change the view file (list.php).

elfuego1
  • profile picture
  • Member

Posted 02 February 2013 - 11:22 AM

OK. Great!
But that doesn't explain what to do.
Could you kindly show me how to do it?

victor
  • profile picture
  • Member

Posted 02 February 2013 - 11:27 AM

the most simple solution is using the "callback column" method , but you can only add a color for the text.

Lucas
  • profile picture
  • Member

Posted 17 March 2015 - 02:41 AM

Fist Call  "callback column"

And retunr something like 

return '<span class="bad-wait" style="color:#CD0A0A;"><i class="fa fa-exclamation-triangle"></i> ' . $dias_faltantes_sobrepasados . ' días ' . $tipo_dias . '</span>';

in the Output File

$('.bad-wait').parent().parent().addClass( "danger" );

It's All

 

Look mi Web

 

Capture.png