Badtable


Set Columns

The set_columns() method is used to define the number of columns in your table object and any properties you wish to set for each column.

As HTML does not have a column element, BadTable will assign column attributes to every td and th element in the column. This together with the ability to add attributes to each row should provide enough flexibility to isolate individual cells in all but the most complicated situation.

There are three ways to call set_columns().

set_columns (int num_columns)

Example:

$this->badtable->set_columns(3);

set_columns (array columns)

The number of columns will be defined by the number of elements in the columns array so you must specify all columns in the array, even if they have no attributes.

Example:

$columns = array(
	0, 
	1 => array('class' => 'highlight'),
	2
);

$this->badtable->set_columns($columns);

set_columns (int num_columns[, array columns])

You are only required to specifiy columns with attributes inteh second parameter as the number of columns is defined by the first parameter.

Example:

$columns = array(
	1 => array('class' => 'highlight')
);

$this->badtable->set_columns(3, $columns);