⚠ In case you've missed it we are migrating 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 forum is read-only and soon will be archived. ⚠


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

Dependent dropdown categories ajax dropdown Categories and sub-categories

  • Please log in to reply
347 replies to this topic

#21 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

Posted 20 November 2012 - 08:09 AM

KaBaDaBrA, :D

#22 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

Posted 20 November 2012 - 09:30 AM

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.

You can use an unlimited number of dependent dropdown.

#23 tofayelahmed

tofayelahmed

    Advanced Member

  • Members
  • PipPipPip
  • 63 posts

Posted 20 November 2012 - 10:24 AM

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

#24 kenshicu

kenshicu

    Advanced Member

  • Members
  • PipPipPip
  • 85 posts

Posted 20 November 2012 - 02: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

#25 tlc033

tlc033

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 20 November 2012 - 04: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:
Posted Image
or this:
Posted Image

#26 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

Posted 20 November 2012 - 05:21 PM

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



#27 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts

Posted 20 November 2012 - 10:31 PM

Victor can you take a look on this?
I have made it a few days before I saw your lib.
http://www.grocerycrud.com/forums/topic/1046-ajax-requery-on-addedit-form/

Can you spot what the problem is?
Thank you.

#28 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

Posted 21 November 2012 - 07:40 AM

The library has been updated.

#29 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts

Posted 21 November 2012 - 08:26 AM

Thank you.
Where do I download it from?

#30 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

Posted 21 November 2012 - 09:30 AM

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

#31 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts

Posted 21 November 2012 - 09:35 AM

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

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!

#32 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

Posted 21 November 2012 - 09:53 AM

I'll try make it:)

#33 tofayelahmed

tofayelahmed

    Advanced Member

  • Members
  • PipPipPip
  • 63 posts

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:
)
);


#34 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

Posted 22 November 2012 - 09:39 AM

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

#35 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

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
-------------------

#36 tofayelahmed

tofayelahmed

    Advanced Member

  • Members
  • PipPipPip
  • 63 posts

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.

#37 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

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


#38 tofayelahmed

tofayelahmed

    Advanced Member

  • Members
  • PipPipPip
  • 63 posts

Posted 22 November 2012 - 10:31 AM

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

Image:2nd.png

#39 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

Posted 22 November 2012 - 10:34 AM

show your code

#40 tofayelahmed

tofayelahmed

    Advanced Member

  • Members
  • PipPipPip
  • 63 posts

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);






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