CodeIgniter Forums

Full Version: Table - Custom Column Width?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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?

El Forum

[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