⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

callback column + array



Robert

Robert
  • profile picture
  • Member

Posted 31 July 2014 - 06:19 AM

I want to pass in a column data from a array
 
// callback column
public function _callback_test($value, $row) {

// array with the info
$test= $this->Misc->getDen($row->id,'aaaa','bbbb','1');

foreach ($test as $key => $value) {
      return $value->xxxx;
}
}
 
the array $test has 4 records but i only see 1 in the view. Any info how can i pass to the column all the array ? Sry for the multipost - i hade a net problem.

 


Amit Shah

Amit Shah
  • profile picture
  • Member

Posted 31 July 2014 - 07:27 AM

well my friend .. read the statement you set with ...

u are returning the value..

when u use return.. thats the end of the functions execution point.. whatever value u return.. it just passes back the control to the parent (the 1 who called the function).

In this case.. i rather suggest u to collect all the output into a string (append each output to be returned .).. all combined together is what u return @the end of the for loop

OR collect all the output to be returned into an array and then implode the same and generate a string and then return the combined string.

 

Hope this solves your problem / trouble..

 

Happy GCing :)


Robert

Robert
  • profile picture
  • Member

Posted 31 July 2014 - 11:39 AM

Hm ... can you give me a example when you have time ?


Robert

Robert
  • profile picture
  • Member

Posted 31 July 2014 - 14:06 PM

Damn that was easy .. if someone gets into this problem to you can use implode :

$test1=implode($test,"<br>");
return $test1;

Thanks a loot 

Amit Shah