Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem returning a view edit_colunm or add_colunm #65

Open
victor-rincon opened this issue Aug 13, 2014 · 0 comments
Open

Problem returning a view edit_colunm or add_colunm #65

victor-rincon opened this issue Aug 13, 2014 · 0 comments

Comments

@victor-rincon
Copy link

I'm trying to make a call_back bring me a view in the datatable but I get a problem this is my code:

Model

    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();
    }

Helper

    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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant