CodeIgniter Forums
Table class - add XHTML attributes to add_row() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Table class - add XHTML attributes to add_row() (/showthread.php?tid=19740)



Table class - add XHTML attributes to add_row() - El Forum - 06-17-2009

[eluser]Unknown[/eluser]
CI noob here. Is there any way to add attributes to the table elements, for example:

Code:
$this->table->add_row(
                form_checkbox('checkbox_'.$user->id, $user->id),
                $display_name,
                $user->role_name,
                $title,
                $user->last_ip,
                date('Y-m-d', strtotime($user->last_login)),
                date('Y-m-d', strtotime($user->created))
            );

I need to add styling to some or all of the cells, for example:

Code:
<td class="checkbox-cell-style">&lt;input type="checkbox" name="checkbox_1" value="1" /&gt;&lt;/td><td>Display_Name</td>...

Is there any way to do this?


Table class - add XHTML attributes to add_row() - El Forum - 06-17-2009

[eluser]brianw1975[/eluser]
Try reading http://ellislab.com/codeigniter/user-guide/libraries/table.html - "Changing the Look of Your Table" is the section you want specifically, "Set_template" should also be checked into.

After those I would look for a pre-existing Table class extension (perhaps in the Wiki, or do a google search) or jump into writing your own class extension.


Table class - add XHTML attributes to add_row() - El Forum - 06-17-2009

[eluser]TheFuzzy0ne[/eluser]
I think I would probably just pass some data into a view, and grab the returned data. It's much more powerful, and just as simple. I think the table class was designed with simple tables in mind.