I'm trying to make a call_back bring me a view in the datatable but I get a problem this is my code:
public function usuarioDataTableJson()
{
// We loaded the helper that generates buttons
$this->load->helper('botones');
$this->datatables
->select("usuarioId AS checkbox, usuarioId, usuario, perfil, empleado, empresa, departamento", FALSE)
->from('vista_usuarios')
->edit_column('checkbox', '<label><input type="checkbox" class="ace" name="usuarios[]" value="$1" /><span class="lbl"></span></label>', 'usuarioId')
->add_column('action', '$1', 'crearBotonAccion(usuarioId, "usuario", empleado, "editar")');
return $this->datatables->generate();
}
function crearBotonAccion($ID=0,$modulo='',$titulo='',$accion='')
{
$CI =& get_instance();
$CI->load->library('session');
$arrayKey= array();
$data = array();
foreach ($CI->session->userdata('SubModulos') as $value) {
$arrayKey = array(
'agregar' => $value->agregar,
'ver' => $value->ver,
'editar' => $value->editar,
'eliminar' => $value->eliminar,
);
$data = array(
'urlAgregar' =>base_url().strtolower($titulo).'/'.$accion,
'url' => base_url().strtolower($titulo).'/'.$accion.'/'.$ID,
'titulo' => strtolower($titulo),
'accion' => $accion,
'id' => $titulo."_".$accion,
);
if($value->nombre == $modulo && $arrayKey[$accion] =='si')
{
return $CI->load->view("botones/".$accion, $data);
}
}
}
If it can be noted in the method we introduce edit_column HTML, here everything goes well
edit_column('checkbox', '<label><input type="checkbox" class="ace" name="usuarios[]" value="$1" /><span class="lbl"></span></label>', 'usuarioId')
But the method add_column where I have a function that returns me a view instead of retornarme html, I get an error
->add_column('action', '$1', 'crearBotonAccion(usuarioId, "usuario", empleado, "editar")')
return $CI->load->view("botones/".$accion, $data);