CodeIgniter Forums
modify class Table to add class in a cell or attrib!!!! - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: modify class Table to add class in a cell or attrib!!!! (/showthread.php?tid=33472)



modify class Table to add class in a cell or attrib!!!! - El Forum - 08-26-2010

[eluser]mashary[/eluser]
Nobody answer me at http://ellislab.com/forums/viewthread/165596/

LOL

so this morning just start to modify main class Table

at line 261
Code:
$out .= $this->template['cell_'.$name.'start'];      
if ($cell === "")
{
$out .= $this->empty_cells;
}
else
{
$out .= $cell;
}
$out .= $this->template['cell_'.$name.'end'];

and i rewrite that line with

Code:
if ( is_array($cell) )
{              
$out .= '<td '.$cell[1].'>';
if ($cell[0] === "")
{
  $out .= $this->empty_cells;
}
else
{
  $out .= $cell[0];
}
  $out .= '</td>';  
}
else
{
  $out .= $this->template['cell_'.$name.'start'];      
  if ($cell === "")
  {
   $out .= $this->empty_cells;
  }
  else
  {
   $out .= $cell;
  }              
   $out .= $this->template['cell_'.$name.'end'];            
}

so you can make special cell now

say that you need to put number in cell using attrib right center or left
so you just type this code
Code:
$table->add_row('No','Name', array('Sell','align="right" class="money"') );

just put array in a value. first arg is your value and second arg is your atrib

^_^ hope these help full