Get list of elements filtered by id

0

For example, I have two tables with relation 1_n (Intervals have one to many deliveries) but I am not able to list the deliveries related to the specific user id filtering in the controller with the where clause. I try the following but it does not list as it should, that is, it lists some elements and not others.

Tables

Driver

public function entregas_lista($idCarga) {

        $crud = new grocery_CRUD();

        $datos = array(
            'title' => "entregas", // En la vista 'header' tendré una variable $title
            'username' => "Administrador"
        );

        $this->load->view('commons/header', $datos);

        //Quitamos los botones de añadir y quitar
        $crud->unset_add();
        $crud->unset_edit();

        $crud->set_language("spanish");
        $crud->set_theme('bootstrap');
        $crud->set_table('entregas');



        $crud->where('idCarga =', $idCarga);



        $crud->display_as('idCarga', 'Nº Entrega');
        $crud->set_subject('Carga / Descarga'); 
        $crud->set_relation('idCarga', 'intervalosHorarios', 'intervaloHorario');

        $crud->columns('fechaCita', 'horaCita', 'numeroEntrega', 'cliente', 'Origen', 'Destino', 'cargaPrevista', 'entregaPrevista', 'accion', 'estado');




        $output = $crud->render();




        $this->_example_output($output);


        //---------------   Cargo la vista 'commons/footer.php'  ------------- /
        $this->load->view('commons/footer');
    }




    function _example_output($output = null) {
        $this->load->view('example', (array) $output);
    }
    
asked by Jose 08.05.2017 в 11:41
source

1 answer

1

$ raw-> set_relation ('idIntervaloHorario', 'intervanciasHorarios', 'intervaleHorario');

    
answered by 08.05.2017 / 12:23
source