Andrew Plummer - Design Development Translation

Example 8: Highlighting Columns

Summary

There are often occasions that you need to style a column differently to make it stand out. You can use the columns option to get this done.

Example

View Example

PHP Code

$tg = new TableGear(array( "database" => array( "username" => "USERNAME", "password" => "PASSWORD", "database" => "DATABASE", "table" => "TABLE" ), "sortable" => "all", "editable" => "all", "loading" => array( "tag" => "img", "attrib" => array( "src" => "/images/icons/loading.gif", "alt" => "Loading...", "class" => "loading" ) ), "formatting" => array( "price" => "currency[prefix=$,pad], "date" => "date" ), "totals" => array("price", 5), "columns" => ("price" => "highlite") );

When we specify a column by either name or number, it will add that class name to every cell in the column, allowing it to be styled. This will include column totals, but not headers. In the example, since our cells already have the class editable, they will now have the class editable highlite.