[eluser]souri84[/eluser]
Hello everybody,
I have a little problem :
I want to add a class for some < tr > tags in my html table.
Here is my code :
Code: foreach($paquet as $key => $val)
{
$array_ss_totaux = array(7, 14, 20, 27, 31, 34, 39);
if(in_array($key, $array_ss_totaux))
{
$tmpl = array('row_start' => '<tr class="Test">');
$ci->table->set_template($tmpl);
}
else
{
$tmpl = array('row_start' => '<tr>');
$ci->table->set_template($tmpl);
}
if($key >=42)
{
$cell = array('data' => '', 'class' => 'test2', 'colspan' => 2);
$ci->table->add_row($val[0],
$cell,
number_format($val[1] + $val[2],2,',',' '));
}
else
{
$ci->table->add_row($val[0],
number_format($val[1],2,',',' '),
number_format($val[2],2,',',' '),
number_format($val[1] + $val[2],2,',',' '));
}
}
But there is no change... there is no < tr > tag with defined class...
Have you got the same problem ?
Thank you,
Bye and have a good WE !
Souri84
[eluser]InsiteFX[/eluser]
You need to define a custom Table Template, best place is in a MY_Controller's Constructor:
Code: $tmpl = array (
'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
'thead_open' => '<thead>',
'thead_close' => '</thead>',
'heading_row_start' => '<tr>',
'heading_row_end' => '</tr>',
'heading_cell_start' => '<th>',
'heading_cell_end' => '</th>',
'tbody_open' => '<tbody>',
'tbody_close' => '</tbody>',
'row_start' => '<tr>',
'row_end' => '</tr>',
'cell_start' => '<td>',
'cell_end' => '</td>',
'row_alt_start' => '<tr class="alt">',
'row_alt_end' => '</tr>',
'cell_alt_start' => '<td>',
'cell_alt_end' => '</td>',
'table_close' => '</table>'
);
$this->table->set_template($tmpl);
[eluser]souri84[/eluser]
ok, thank you for your answer !
|