⚠ 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

Add/Edit/Delete using where as a variable



Linkark07
  • profile picture
  • Member

Posted 25 August 2014 - 12:49 PM

Good morning.

 

Thanks for making this great library. It has really helped me with my project.

 

My question, and problem, is this: how to use add/edit/delete and all the other options using where as a variable? Right now I'm doing an attendance list, and for it to work the user must select a group from a dropdown. This is when the problem comes in; the list with the selected group appears but the user can't use any of the options.

 

Here is the code:

$this->form_validation->set_rules('group', 'Grupo', 'trim|xss_clean');
                if($this->form_validation->run() == FALSE)
                {
                    $this->seleccionar_grupo();
                }else{
                $grupo = $this->input->get('grupo', TRUE);
                 $this->grocery_crud->where('id_grupo', $grupo); //Here is when I use a variable for get the group_id.
                     $this->grocery_crud->display_as('id_participante', 'Cédula');
                      $this->grocery_crud->display_as('id_grupo', 'Grupo');
        $this->grocery_crud->set_subject('Participante');
        $this->grocery_crud->set_relation('id_participante', 'participante', 'numero_identificacion');
              $this->grocery_crud->set_table('asistencia');
    $this->grocery_crud->edit_fields('clase', 'observaciones');
       $this->grocery_crud->unset_delete();
                $this->grocery_crud->unset_add();
                $this->grocery_crud->unset_export();
                $this->grocery_crud->unset_print();
            $output = $this->grocery_crud->render();
 
        $this->ver_lista($output);
 

Amit Shah
  • profile picture
  • Member

Posted 04 September 2014 - 04:33 AM

what exactly you trying to achieve ..  can u explain - then i might be able to help you on the same.