hello, I can filter a dropdown and with this filter a multiselect?
[updated 24/11/2012] Dependent dropdown (library)
Posted 03 July 2013 - 18:02 PM
Posted 03 July 2013 - 18:12 PM
Hi! Much time I haven't seen you!
do you want to make a dependent multi-select field which depends from the select?
--> set select value---> ajax--> get multiselect .
Explain please. I don't understand enough
Posted 03 July 2013 - 18:28 PM
hi!, lately I have little time to connect here.
I have two dropdowns dependent ok, but I need to put dependent a multiselect, to the second dropdown.
this multiselect is the result of a set_relation_n_n
sorry my bad english
Posted 03 July 2013 - 18:50 PM
draw a scheme of your tables and what you want to get.
But this library does not supports this functionality.
you can make it without my library.
Posted 03 July 2013 - 19:23 PM
I want to achieve is this:
[attachment=592:multi-select2.jpg]
this is my schema
[attachment=593:schema.jpg]
I need to filter the workplace (centro_trabajo), which belong to the municipalities (municipio), which belong to a state (provincia). With this filtered, using the multi-select enable the user to manage the workplaces, which is assigned.
The main table is user.
is a mess :)
Posted 25 July 2013 - 00:51 AM
first of all im new to Grocery crud and congrats for the nice libraries.. i have a problem using this dependent drop down.
i dont have error: but the second table locked(not clickable).. example on add view on my faculty_list table when i click drop down on campus_id and select on the college_id is locked.
my sample table:
faculty_list
id
lname
fname
campus_id (related to campus table)
college_id (related to school_college table)
campus table
id
name
school_college
id
name
campus_id(related to campus table)
my code:
$crud->set_relation('campus_id', 'campus','name');
$crud->set_relation('college_id','school_college','name');
$this->load->library('gc_dependent_select');
$fields = array(
'campus_id' => array(// first dropdown name
'table_name' => 'campus', // table of country
'title' => 'name', // country title
'relate' => null // the first dropdown hasn't a relation
),
'college_id' => array(// second dropdown name
'table_name' => 'school_college', // table of state
'title' => 'name', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'campus_id', // table of state:
'data-placeholder' => 'Select Subcategory' //dropdown's data-placeholder:
)
);
$config = array(
'main_table' => 'faculty_list',
'main_table_primary' => 'id',
"url" => base_url() . __CLASS__ . '/' . __FUNCTION__ . '/',
);
$categories = new gc_dependent_select($crud, $fields, $config);
$js = $categories->get_js();
$output = $crud->render();
$output->output.= $js;
$this->output($output);
Posted 29 July 2013 - 08:01 AM
I always get 404 page not found error.
my schema is this:
CITY TABLE
city id
city name
SPORTS TABLE
sports id
sports name
SPORTSCITYMAPPING
mapping id
sports id
city id
i want to select city and on basis of that the sports get listed.
But it never works and i get the 404 error.
Please help.
Posted 29 July 2013 - 08:31 AM
You should read the topic. There is a solution of your problem
Posted 29 July 2013 - 09:08 AM
i tries that too. still does not work. :(
Posted 29 July 2013 - 09:09 AM
First show your code.
do you use index.php in query string?
Posted 29 July 2013 - 09:23 AM
Nopes.
yay!!! I got it to work. But i get alerts with [object Object]
how do i get to list the sports name in the dropdown.?
Thanks for your help.
Posted 29 July 2013 - 09:32 AM
I'm not a psychic ) I don't know what you do )
Posted 29 July 2013 - 09:34 AM
$crud->set_relation('SportsCityID', 'SportsCity', 'SportsCityName'); $crud->set_relation('SportsSportID', 'SportsSport', 'SportName'); $crud->set_relation('SportsFormatID', 'SportsFormat', 'FormatName'); $crud->set_relation('SportsLevelID', 'SportsLevel', 'LevelName'); $crud->set_relation('SportsFacilityID', 'SportsFacility', 'FacilityName'); // settings $fields = array( // first field: 'SportsCityID' => array( // first dropdown name 'table_name' => 'SportsCity', // table of country 'title' => 'SportsCityName', // country title 'relate' => null // the first dropdown hasn't a relation ), // second field 'SportsSportID' => array( // second dropdown name 'table_name' => 'SportsCityMapping', // table of channels 'title' => 'SportsSportID', // //Sports name 'id_field' => 'SportsSportID', // table of Sports: primary key 'relate' => 'SportsCityID', // table of sports city: 'data-placeholder' => 'Select Sports' //dropdown's data-placeholder: ) ); $crud->callback_column('LeagueStatus',array($this,'_callback_display_status')); $crud->add_fields('LeagueName', 'SportsCityID', 'SportsSportID','SportsFormatID','SportsLevelID'); $crud->field_type('LeagueStatus', 'active_inactive'); //set validation rules $config = array( 'main_table' => 'SportsLeague', 'main_table_primary' => 'LeagueID', 'url' => admin_url() . __CLASS__ . '/' . __FUNCTION__ . '/', 'ajax_loader' => admin_assets_url() . 'img/ajax-loader.gif' // path to ajax-loader image. It's an optional parameter ); $sports = new gc_dependent_select($crud, $fields, $config); // the second method: $js = $sports->get_js(); $output = $crud->render(); $output->output.= $js; $this->_example_output($output);
Posted 29 July 2013 - 09:36 AM
and what result do you get?
Posted 29 July 2013 - 09:41 AM
i get the dropdown for sports, bu i want to display name of the sports. Since sports is not in the SportsCityMapping table, how do i get it from the Sports table?
P.S. that alert was due to my debugging :)
Posted 29 July 2013 - 10:07 AM
another thing, how do i get dependent listing of two or more fields, on select of one. like if i select Sport, i should get both level and format dropdowns for that particular sports . Is it possible??
any idea how do i display Sports name in my dropdown? Please help.
Posted 29 July 2013 - 10:09 AM
you should make own code :)
Posted 29 July 2013 - 10:14 AM
you mean to say i cannot use this awesome library :(
Posted 29 July 2013 - 10:14 AM
Posted 29 July 2013 - 10:16 AM
if you know php well it's not difficult to make the same.