⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

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



victor

victor
  • profile picture
  • Member

Posted 20 November 2012 - 08:09 AM

KaBaDaBrA, :D

victor

victor
  • profile picture
  • Member

Posted 20 November 2012 - 09:30 AM

[quote name='kenshicu' timestamp='1353363178' post='4332']
well, I'll be waiting ...

tu libreria soporta 3 o mas Dependent dropdown?, funciona con uno solo?
disculpa la pregunta es que no he tenido tiempo de revisar tu libreria.
[/quote]
You can use an unlimited number of dependent dropdown.

tofayelahmed

tofayelahmed
  • profile picture
  • Member

Posted 20 November 2012 - 10:24 AM

Hi victor! The problems are solved.
You are really hero.
Thanx your library and support.

kenshicu

kenshicu
  • profile picture
  • Member

Posted 20 November 2012 - 14:07 PM

amazing the library, works great. just need to not hide the Dependent dropdown, I tried to comment out the lines 132.133 and that's something, but lack.
Another aesthetic detail I saw is when clicking on the cross of parent dropdown, the ajax_loader stays running (should reset all dropdown).

Thanks to all

tlc033

tlc033
  • profile picture
  • Member

Posted 20 November 2012 - 16:42 PM

Hi.

I try to chose from
// first field:
then from
// second field

but then i delete from
// first field: aiax-loader is loading, and in the //second field list is not working.
Like this:
[img]http://s17.postimage.org/qn2ikydm7/image.png[/img]
or this:
[img]http://s10.postimage.org/7czv5m0sp/image.png[/img]

victor

victor
  • profile picture
  • Member

Posted 20 November 2012 - 17:21 PM

Yes, tlc033, there is this a problem. I'll try fix it.


davidoster

davidoster
  • profile picture
  • Member

Posted 20 November 2012 - 22:31 PM

Victor can you take a look on this?
I have made it a few days [b]before[/b] I saw your lib.
/topic/1046-ajax-requery-on-addedit-form/

Can you spot what the problem is?
Thank you.

victor

victor
  • profile picture
  • Member

Posted 21 November 2012 - 07:40 AM

The library has been updated.

davidoster

davidoster
  • profile picture
  • Member

Posted 21 November 2012 - 08:26 AM

Thank you.
Where do I download it from?

victor

victor
  • profile picture
  • Member

Posted 21 November 2012 - 09:30 AM

you can download it on the first page(the first post of this topic)

davidoster

davidoster
  • profile picture
  • Member

Posted 21 November 2012 - 09:35 AM

[quote name='victor' timestamp='1353490224' post='4354']
you can download it on the first page(the first post of this topic)
[/quote]
Thanks a lot!
If you manage at some point to implement the extra feature when the 'title' => '{day} {hour} {description}' looks something like this would be great!
I am looking also in to it...
Thanks!

victor

victor
  • profile picture
  • Member

Posted 21 November 2012 - 09:53 AM

I'll try make it:)

tofayelahmed

tofayelahmed
  • profile picture
  • Member

Posted 22 November 2012 - 09:36 AM

Hello victor!
I need to 2 dependent dropdown menu.
Whats the technique?
I try but only the last one work.
My code is below

$fields = array(

// first field:
'category_id' => array( // first dropdown name
'table_name' => 'category', // table of country
'title' => 'country_title', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'subcategory_id' => array( // second dropdown name
'table_name' => 'sub_category', // table of state
'title' => 'subcategory_name', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'category_id', // table of state:
'data-placeholder' => 'Select Subcategory' //dropdown's data-placeholder:
)
);
$fields = array(
// first field:
'zone_id' => array( // first dropdown name
'table_name' => 'zone', // table of country
'title' => 'country_title', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'subzone_id' => array( // second dropdown name
'table_name' => 'sub_zone', // table of state
'title' => 'subzone_name', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'zone_id', // table of state:
'data-placeholder' => 'Select Subzone' //dropdown's data-placeholder:
)
);

victor

victor
  • profile picture
  • Member

Posted 22 November 2012 - 09:39 AM

show your tables structure. What version of library do you use?

victor

victor
  • profile picture
  • Member

Posted 22 November 2012 - 09:42 AM

Ah! Do You need two sets of dropdowns menu on the one page?


field 1
field 2

----------------------------
menu 1
menu 2
---------------------------
.....
....
other fields
....
....
____________

menu 3
menu 4
-------------------

tofayelahmed

tofayelahmed
  • profile picture
  • Member

Posted 22 November 2012 - 09:51 AM

Thanks victor!
I need the technique when use two dependent dropdown.
Like:
1.Input field "subzone_name" depends on field "zone_name".
2.Input field "subcategory_name" depends on field "category_name".
Thanks.

victor

victor
  • profile picture
  • Member

Posted 22 November 2012 - 09:56 AM

I have not tried it, but I think it will work:

$fields = array(
// first field:
'category_id' => array( // first dropdown name
'table_name' => 'category', // table of country
'title' => 'country_title', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'subcategory_id' => array( // second dropdown name
'table_name' => 'sub_category', // table of state
'title' => 'subcategory_name', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'category_id', // table of state:
'data-placeholder' => 'Select Subcategory' //dropdown's data-placeholder:
)
);

$config = array(
// your config
);
$categories = new gc_dependent_select(&$crud, $fields, $config);
$js = $categories->get_js();



$fields2 = array(
// first field:
'zone_id' => array( // first dropdown name
'table_name' => 'zone', // table of country
'title' => 'country_title', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'subzone_id' => array( // second dropdown name
'table_name' => 'sub_zone', // table of state
'title' => 'subzone_name', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'zone_id', // table of state:
'data-placeholder' => 'Select Subzone' //dropdown's data-placeholder:
)
);


$config2 = array(
// your config
)
$categories2 = new gc_dependent_select(&$crud, $fields2, $config2);
$js2 = $categories2->get_js();


$output = $crud->render();
$output->output.= $js.$js2

tofayelahmed

tofayelahmed
  • profile picture
  • Member

Posted 22 November 2012 - 10:31 AM

Hi.
Only the first one is work, the last one is hang.

Image:[attachment=368:2nd.png]

victor

victor
  • profile picture
  • Member

Posted 22 November 2012 - 10:34 AM

show your code

tofayelahmed

tofayelahmed
  • profile picture
  • Member

Posted 22 November 2012 - 10:51 AM

OKEY!

$fields1 = array(

// first field:
'category_id' => array( // first dropdown name
'table_name' => 'category', // table of country
'title' => 'country_title', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'subcategory_id' => array( // second dropdown name
'table_name' => 'sub_category', // table of state
'title' => 'subcategory_name', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'category_id', // table of state:
'data-placeholder' => 'Select Subcategory' //dropdown's data-placeholder:
)
);
$fields = array(
// first field:
'zone_id' => array( // first dropdown name
'table_name' => 'zone', // table of country
'title' => 'zone_name', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'subzone_id' => array( // second dropdown name
'table_name' => 'sub_zone', // table of state
'title' => 'subzone_name', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'zone_id', // table of state:
'data-placeholder' => 'Select Subzone' //dropdown's data-placeholder:
)
);

$config1 = array(
'main_table' => 'zone_allocate_subzone',
'main_table_primary' => 'id',
"url" => base_url() .'index.php/'. __CLASS__ . '/' . __FUNCTION__ . '/',
'ajax_loader' => base_url() . 'ajax-loader.gif' // path to ajax-loader image. It's an optional parameter
);
$categories1 = new gc_dependent_select($crud, $fields1, $config1);
//$output = $categories->render();
$js1 = $categories1->get_js();


$fields2 = array(
// first field:
'zone_id' => array( // first dropdown name
'table_name' => 'zone', // table of country
'title' => 'zone_name', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'subzone_id' => array( // second dropdown name
'table_name' => 'sub_zone', // table of state
'title' => 'subzone_name', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'zone_id', // table of state:
'data-placeholder' => 'Select Subzone' //dropdown's data-placeholder:
)
);

$config2 = array(
'main_table' => 'zone_allocate_subzone',
'main_table_primary' => 'id',
"url" => base_url() .'index.php/'. __CLASS__ . '/' . __FUNCTION__ . '/',
'ajax_loader' => base_url() . 'ajax-loader.gif' // path to ajax-loader image. It's an optional parameter
);
$categories2 = new gc_dependent_select($crud, $fields2, $config2);
//$output = $categories->render();
$js2 = $categories2->get_js();


$output = $crud->render();
$output->output.= $js1.$js2;
$this->badc_output($output);