CodeIgniter Forums
How to add attributes to table rows? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: How to add attributes to table rows? (/showthread.php?tid=64529)



How to add attributes to table rows? - eldan88 - 03-01-2016

Hi,

I been reading through the table class and see how I can add attributes to table cells, but I can't find any where else on where to add attributes on table rows.

I know I can use the set_template method.. But the problem is that I need to be adding unique attributes to a table row using a foreach loop.

Does anyone know how I can accomplish this?

Any help would be really appreciated!


RE: How to add attributes to table rows? - keulu - 03-01-2016

i don't know if you can do it with add_row()

PHP Code:
$cell = array('data' => 'Blue''class' => 'highlight''colspan' => 2);
$this->table->add_row($cell'Red''Green'); 

this is for a cell, but try that

PHP Code:
$cell = array('data' => array('Red''Green''Blue'), 'class' => 'highlight');
$this->table->add_row($cell); 

maybe that work but personnaly, i don't use this lib.


RE: How to add attributes to table rows? - eldan88 - 03-01-2016

Hey keulu. Thanks for the reply. Unfortunately that did not work.