[eluser]rajneeshgobin[/eluser]
originally i had this piece of code
Code:
$heading = array('No','usergroup', 'platform', 'reference','id');
$CI->table->set_heading($heading);
$i = 0 + $offset;
foreach ($parents as $parent){
$CI->table->add_row(++$i, $parent->usergroup, $parent->platform, $parent->reference,$parent->id);
}
//print_r($my_row);
$data['table'] = $CI->table->generate();
to make it a little mode dynamic i converted it to
Code:
$myArray=array('usergroup', 'platform', 'reference','id');
$tempArray = $myArray;
array_unshift($tempArray, 'No');
//$heading = array('No','usergroup', 'platform', 'reference','id'); <---- to make it like this i use unshift
$heading = $tempArray ;
$CI->table->set_heading($heading);
$i = 0 + $offset;
$toArrayparents = (array) $parents;
foreach ($toArrayparents as $parent) {
$toArraysingleParent = (array) $parent;
$my_row['No'] = ++$i;
foreach($myArray as $val) {
$my_row[$val] = $toArraysingleParent[$val];
}
//$CI->table->add_row(++$i, $book['usergroup'], $book['platform'], $book['reference'],$book['id']);
$CI->table->add_row($my_row);
}
//print_r($my_row);
$data['table'] = $CI->table->generate();
now the problem is
i have a blank column at the begining and an extra column in the table going out of the header