• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change layout for specified rows

How can I change the layout of specified rows (not all rows) with the HTML Table Class in CodeIgniter? I tried it with the template array, but this effects the entire table respectively all rows.

$tmpl = array (
    'table_open'          => '<table border="0" cellpadding="4" cellspacing="0">',
    'heading_row_start'   => '<tr>',
    'heading_row_end'     => '</tr>',
    'heading_cell_start'  => '<th>',
    'heading_cell_end'    => '</th>',
    'row_start'           => '<tr>',
    'row_end'             => '</tr>',
    'cell_start'          => '<td>',
    'cell_end'            => '</td>',
    'row_alt_start'       => '<tr>',
    'row_alt_end'         => '</tr>',
    'cell_alt_start'      => '<td>',
    'cell_alt_end'        => '</td>',
    'table_close'         => '</table>'

Incorporate CSS, you can use ID or Class.
Class is better.

<tr class="row5"> </tr>

you get the idea.

all i want to do is to colorize a specific row depending on if Condition

The Table library as is does not support that. You'll need to extend the library to add that feature, or just create the table HTML manually.

You may try this method:
(correct me if i misunderstand your question)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
&lt;html xml:lang="en" lang="en"&gt;

&lt;meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Alternating Color&lt;/title&gt;
    &lt;style type="text/css"&gt;

            <th>Alternate Color</th>
        &lt;?php for($i=0;$i<=10;$i++):?&gt;
            <tr class="&lt;?php echo (($i%2)==0) ? "gray" : "green"?&gt;">
                <td>&lt;?php echo (($i%2)==0) ? "gray" : "green"?&gt;</td>
        &lt;?php endfor;?&gt;

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.