⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Get element list with a specific id



jospalgal

jospalgal
  • profile picture
  • Member

Posted 08 May 2017 - 09:54 AM

For example, i have two tables ('intervalosHorarios' and 'entregas' [1_n]) and i want to show 'entregas' list from specific 'intervalosHorarios' id. I tried the following but it didn't work.

 

2O8B7.png

 

 

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