Jump to content


Dependent dropdown (library) not working

Dependent dropdown dropdown

  • Please log in to reply
3 replies to this topic

#1 Ritesh Singh

Ritesh Singh

    Newbie

  • Members
  • Pip
  • 4 posts

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



#2 Victor Castillo

Victor Castillo

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 13 April 2016 - 05:34 PM

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



#3 Php Power Arts

Php Power Arts

    Newbie

  • Members
  • Pip
  • 8 posts

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 ?



#4 Php Power Arts

Php Power Arts

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 05 June 2016 - 12:34 PM

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







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users