Please help , its not work for me this is my code , i just find the second dropdown menu disabled and not changed any idea ?
function index()
{
$this->load->library('grocery_CRUD');
if (!$this->ion_auth->logged_in()) {
// redirect them to the login page
redirect('user/login', 'refresh');
} else {
$crud = new Grocery_CRUD();
$crud->set_table('venues');
$crud->set_subject(' ');
$crud->unset_delete();
//$crud->unset_jquery();
$crud->unset_bootstrap();
$crud->unset_export();
$crud->unset_print();
$crud->unset_read();
$crud->unset_list();
$crud->unset_back_to_list();
$crud->unset_fields('v_started_date', 'v_end_date', 'v_active', 'user_id', 'v_event_counter');
$crud->unset_edit_fields('v_started_date', 'v_end_date', 'v_active', 'user_id', 'v_event_counter', 'v_accept_agreement');
$crud->display_as('v_name', __('Venue Name'))
->display_as('region_id', __('Region'))
->display_as('location_id', __('Location'))
->display_as('v_logo', __('Venue Logo'))
->display_as('v_address_1', __('Address 1'))
->display_as('v_address_2', __('Address 2'))
->display_as('v_city', __('City'))
->display_as('v_phone_number', __('Phone Number'))
->display_as('v_accept_agreement', '');
// fields type
$crud->set_field_upload('v_logo', 'assets/uploads/files');
$crud->set_relation('region_id', 'regions', 'country');
$crud->set_relation('location_id', 'locations', 'location');
// dependent dropDown menu
$this->load->library('gc_dependent_select');
$fields = array(
// first field:
'region_id' => array( // first dropdown name //
'title' => 'country', //
'relate' => null // the first dropdown hasn't a relation
),
// second field
'location_id' => array( // first dropdown name
'table_name' => 'locations',
'title' => 'location',
'id_field' => 'location_id',
'relate' => 'region_id',
'data-placeholder' => 'Select Location'
));
$config = array(
'main_table' => 'regions',
'main_table_primary' => 'region_id',
"url" => base_url() .__CLASS__ . '/' . __FUNCTION__ . '/',
'ajax_loader' => '',
'segment_name' => '' // It's an optional parameter. by default "get_items"
);
$categories = new gc_dependent_select($crud, $fields, $config);
// first method:
//$output = $categories->render();
// the second method:
// callback function
$crud->callback_add_field('v_accept_agreement', array($this, 'add_field_v_accept_agreement'));
$crud->callback_after_insert(array($this, 'insert_start_date_after_insert'));
// validation fields
$crud->required_fields('v_name', 'v_accept_agreement');
$crud->set_rules('v_accept_agreement', '', 'callback_required_field_v_accept_agreement_msg');
// elements change text
$crud->set_lang_string('form_save', __('Subscribe Now'));
$crud->set_lang_string('insert_success_message',
' Your data has been successfully stored into the database.
<br/>
Please wait while you are redirecting to the list page.
<script type="text/javascript">
window.location = "' . site_url() . '";
</script>'
);
$js = $categories->get_js();
$output = $crud->render();
$output->output .= $js;
$this->load->vars($output);
$this->layout->render_page('venue/index');
}
}