简体   繁体   English

杂货杂货店不显示所有添加的物品

[英]Grocery Crud not showing all items added

I have 'intervalosHorarios' and 'entregas' in my proyect, and when i clic on an 'intervaloHorario' it shows 'entregas' from that 'intervaloHorario'. 我的proyect中有“ intervalosHorarios”和“ entregas”,当我选择“ intervaloHorario”时,它显示的是来自“ intervaloHorario”的“ entregas”。 The problem is to add more 'entregas' because it's showing only the fist one added. 问题是要添加更多的“ entregas”,因为它只显示了第一个添加的拳头。 I wanna show all 'entregas' inside that 'intervaloHorario'. 我想展示“ intervaloHorario”中的所有“ entregas”。 Any ideas? 有任何想法吗?

Tables 桌子 在此处输入图片说明

Controller 控制者

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

When I clic on 'De 12:00 a 13:30 it shows the same rows that 'De 7:00 a 8:30' link, and if i uncomment 'where' clause, it shows fine (the information of that link) but only with one row. 当我选择“ De 12:00 a 13:30”时,它显示与“ De 7:00 a 8:30”链接相同的行,并且如果我取消注释“ where”子句,则显示很好(该链接的信息)但只有一行。

Interval table 间隔表 在此处输入图片说明

Delivery table 交货台 在此处输入图片说明

You are setting $crud->where('idCarga =', $idCarga); 您正在设置$crud->where('idCarga =', $idCarga); and I suppose that $idCarga is the PK of 'Entregas' table and PK's are unique. 我认为$idCarga是“ Entregas”表的PK,而PK是唯一的。 So it can be only one row for each PK. 因此,每个PK只能是一行。

EDIT: $crud->where('entregas.idIntervaloHorario =', $idCarga); 编辑: $crud->where('entregas.idIntervaloHorario =', $idCarga); to mach every row which has FK of 'IntervalosHorarios' table. 处理具有“ IntervalosHorarios”表的FK的每一行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM