I have a table with a column that store a FK from another table.
I use set_relation to display on each row instead of the id, some other info's related from the fk table.
I also want to make that field a link, to send the user to an url when clicked and I want to achieve this by using callback_column function. However, it seems that set_relation function is overwriting the callback_column function.
Here is my code:
$crud->columns('id_excursion','date_group','date_pickup','max_pax','id_creator');
$crud->set_relation('id_creator','persons','{lname} {fname} <br/>{email}');
$crud->callback_column('id_creator', array($this,'linkContact'));
my callback function
function linkContact($value, $row){
return "<a href='".base_url('admin/admin/contactPerson/'.$row->id_creator)."'>$value</a>";
}
I also want to mention that if I try to add the link to the other controller/action in the set_relation third param like:
$crud->set_relation('id_creator','persons','<a href="'.base_url('admin/admin/contactPerson/'.'{id}'.).'">{lname} {fname} <br/>{email}</a>');
The tags/links get stripped in a nasty way and links never get displayed...
Looking forward for a reply!