CodeIgniter Forums
Table - Custom Column Width? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Table - Custom Column Width? (/thread-28416.html)



Table - Custom Column Width? - El Forum - 03-10-2010

[eluser]ripken204[/eluser]
i am using the table class and it is working fine for me, the only issue i have is that i am not sure how to set the width of different columns.

for example, i have a first name, last name, address column.
the table class just does its own thing as far as column width goes, i would like to be able to manually the first name column to a certain with, set last name to its own certain width, etc.

does anyone know if this is possible with CI?


Table - Custom Column Width? - El Forum - 07-19-2011

[eluser]Unknown[/eluser]
You can do so by edit the information you send to table->add_row function.

For example, instead of calling $
Code:
this->table->add_row('apple', 'orange')
call the following
Code:
$this->table->add_row(array('data'=>'apple', 'style'=>'width:100px', array('data'=>'orange'), 'style'=>'width:200px;');

Not sure this is the best way, but it works