Welcome Guest, Not a member yet? Register   Sign In
CI table class
#1

[eluser]mjstenbe[/eluser]
Is it possible to customize table template to include db variables such as row and cell numbers as id's or classes and so? I noticed that template only has one beginning tag for tr's and td's, but what if i'd like to change the class for each?

What Im hoping to produce is something like:

Code:
<table>
<tr class="1">
            <td class="id_cell">38</td>
            <td class="1">sdfsdf</td>
            <td class="2"></td>
            <td class="3">sdf</td>
</tr>
<tr class="2">
  <td class="id_cell">39</td>
            <td class="1">sdfsdf</td>
            <td class="2"></td>
            <td class="3">sdf</td>
</tr>
</table>

Thanks,
Mika
#2

[eluser]Maglok[/eluser]
You can do alternating classes like so:
Code:
$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>'
              );

$this->table->set_template($tmpl);
See user_guide: http://ellislab.com/codeigniter/user-gui...table.html

I take it you want more customization, I personally use some custom code then because the table class isn't that expansive.




Theme © iAndrew 2016 - Forum software by © MyBB