⚠ 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

Dependent dropdown (library) not working



Ritesh Singh
  • profile picture
  • Member

Posted 12 September 2015 - 11:44 AM

Hii i am new to grocery crud, I have used dependent dropdowns library by victor,but its not working for me.

below is my code



 $this->load->library('gc_dependent_select');
        $crud = $this->crud->generate_crud('area');
        $crud->set_relation('location_2_id','city','name');
        $crud->set_relation('location_1_id','state','name');
        $fields = array(

        // first field:
        'category_id' => array( // first dropdown name
        'table_name' => 'state', // table of country
        'title' => 'name', // country title
        'relate' => null // the first dropdown hasn't a relation
        ),
        // second field
        'subcategory_id' => array( // second dropdown name
        'table_name' => 'city', // table of state
        'title' => 'name', // state title
        'id_field' => 'id', // table of state: primary key
        'relate' => 'location_2_id', // table of state:
        'data-placeholder' => 'select sss' //dropdown's data-placeholder:

        )
        );
        $config = array(
        'main_table' => 'area',
        'main_table_primary' => 'id',
        "url" => base_url('admin/location') . __CLASS__ . '/' . __FUNCTION__ . '/',
        //'ajax_loader' => base_url() . 'ajax-loader.gif' // path to ajax-loader image. It's an optional parameter
        );
        $categories = new gc_dependent_select($crud, $fields, $config);
        $js = $categories->get_js();
        
        
        $crud->display_as('location_1_id','State');
        $crud->display_as('location_2_id','City');
        //$this->mViewData['crud_data'] .=$js;
        
        $this->mViewData['crud_data'] = $this->crud->render(); 
        $crud->required_fields('name');
        $this->render('crud');

Please help


Victor Castillo
  • profile picture
  • Member

Posted 13 April 2016 - 17:34 PM

the same problem, my child dropdown keep disable,i dont know how resolve it.


Php Power Arts
  • profile picture
  • Member

Posted 05 June 2016 - 12:33 PM

the same problem, my child dropdown keep disable,i dont know how resolve it.

Me too the same thing like you , any help please ?


Php Power Arts
  • profile picture
  • Member

Posted 05 June 2016 - 12:34 PM

i used GC 1.5 , its not working with it :(  (my child dropdown keep disable)