CodeIgniter Forums
Add class to row with HTML Table Class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Add class to row with HTML Table Class (/showthread.php?tid=77414)



Add class to row with HTML Table Class - AngelRodriguez - 08-28-2020

Hi,

 I see in the documentation that you can add class to cell items like this:

Code:
$cell = ['data' => 'Blue', 'class' => 'highlight', 'colspan' => 2];

$table->addRow($cell, 'Red', 'Green');

But can you add class to entire row? or is not possible?

Something like this:

Code:
$row = ['data' => [123,567,789], 'class' => 'row-class'];

$table->addRow($row);



RE: Add class to row with HTML Table Class - InsiteFX - 08-28-2020

If you look in the User Guide on the Table it has a Template that you configure for everything.

I use it to make bootstrap tables, I load it in the __constructor to make it available to all.


RE: Add class to row with HTML Table Class - AngelRodriguez - 08-28-2020

The template applys to all elements. I want some rows to have specific class, not all.

For example, having all row background color red, green or gray defined by status, etc.