I am trying to change column value using callback_column
function.
$crud = new grocery_CRUD();
$crud -> set_table('booking');
//$crud->set_relation('room_id','rooms','name');
$crud->callback_column('room_id',array($this,'_visitor_details_popup'));
This code workings well (_visitor_details_popup
function return value to room_id
)
$crud = new grocery_CRUD();
$crud -> set_table('booking');
$crud->set_relation('room_id','rooms','name');
$crud->callback_column('room_id',array($this,'_visitor_details_popup'));
This code NOT workings well (room_id
not changing)
public function _visitor_details_popup($value, $row)
{
$visitor_details=explode(',',$value);
return '<a href="#">Name'.$visitor_details[1].'<a>'.'<div class="popup_content">Address'.$visitor_details[2].'Email'.$visitor_details[3].'</div>;
}
Is this a bug in grocery crud?? Any tricky way to solve it??
I got a trick. create a function and call it on callback_column parameter..
$crud = new grocery_CRUD();
$crud -> set_table('booking');
$crud->set_relation('room_id','rooms','name');
$crud->callback_column(unique_field_name('room_id'),array($this,'_visitor_details_popup')); verity
function unique_field_name($field_name)
{
return 's'.substr(md5($field_name),0,8); //This s is because is better for a string to begin with a letter and not with a number
}