Jump to content


[updated 24/11/2012] Dependent dropdown (library)

Dependent dropdown categories ajax dropdown Categories and sub-categories

  • Please log in to reply
344 replies to this topic

#341 greyson

greyson

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 08 April 2018 - 10:31 PM

field 2 inactive, someone could help



#342 avi

avi

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 09 April 2018 - 09:06 AM

Hi Guys,

 

It's a great library..

 

I have some problem, the second select list is updated but it's still disabled.. 

 

The select option is updated accordingly, however the JQuery Chosen is still disabled and it's not populated..

 

I wonder if someone has similar situation



#343 priyanka

priyanka

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 08 May 2018 - 05:25 AM

Hi, I am new to grocery crud library. For dependent dropdown, I used gc_dependent_select library. first dropdown work fine but second dropdown is disabled on page load as well as onchange firts dropdown. Please help me out

Please find the attached screenshot. URL: https://www.screenca.../t/Xg88C9Th4byT

 

thanks

 



#344 sandeep88

sandeep88

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 16 May 2018 - 06:31 AM

Hi, I'm a newbie to GC and I have managed to install it successfully. Now I'm trying to add the dependent select box with this library. I'm getting values in the country dropdown, but state and city dropdowns seem to be disabled. I think I'm having issues with including js files, please find attached files. Also, I have created the foreign key between tables country, state and city.

 

Pasting the controller function 

***********************************************************************

public function locs_management()
{
$crud = new grocery_CRUD();
$crud->set_theme('datatables');
$crud->set_table('locations');
$crud->set_relation('con_id','country','name');
$crud->set_relation('st_id','state','st_name');
$crud->set_relation('ct_id','city','ct_name');
$this->load->library('gc_dependent_select');
 
$fields = array(
 
// first field:
'con_id' => array( // first dropdown name
'table_name' => 'country', // table of country
'title' => 'name', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'st_id' => array( // second dropdown name
'table_name' => 'state', // table of state
'title' => 'st_name', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'con_id', // table of state:
'data-placeholder' => 'select state' //dropdown's data-placeholder:
 
),
// third field. same settings
'ct_id' => array(
'table_name' => 'city',
//'where' =>"post_code>'167'",  // string. It's an optional parameter.
//'order_by'=>"state_title DESC",  // string. It's an optional parameter.
'title' => 'id: {id} / city : {ct_name}',  // now you can use this format )))
'id_field' => 'city_id',
'relate' => 'st_id',
'data-placeholder' => 'select city'
)
);
 
$config = array(
'main_table' => 'locations',
'main_table_primary' => 'id',
"url" => base_url() . __CLASS__ . '/' . __FUNCTION__ . '/', //path to method
//'ajax_loader' => base_url() . 'ajax-loader.gif' // path to ajax-loader image. It's an optional parameter
//'segment_name' =>'Your_segment_name' // It's an optional parameter. by default "get_items"
);
//print_r ($crud);
        //print_r ($fields);
        //print_r ($config);
$categories = new gc_dependent_select($crud, $fields, $config);
$js = $categories->get_js();
$output = $crud->render();
$output->output.= $js;
$this->_example_output($output);
 
 
}

***********************************************************************

Thanks in advance.



#345 ekobudi79

ekobudi79

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 13 June 2018 - 05:43 AM

Hi Victor,

 

I have same problem like everyone, the first dropdown can be used, when i select one option the first dropdown the second dropdown still disabled. I am using GC 1.6 and your library version 1.5.

Please help me. Thanks.







Also tagged with one or more of these keywords: Dependent dropdown, categories, ajax, dropdown, Categories and sub-categories

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users