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
