Populating a custom field drop down via jQuery....

  • Posts: 62
  • Thank you received: 0
10 years 9 months ago #168428

-- HikaShop version -- : 2.3.2
-- Joomla version -- : 3.3.3

Hi,

I have defined a custom field as a drop down that I want to populate via jQuery. The jQuery code finds the select control but I cannot seem to get the drop down to populate. As it looks like there is some special handling of the drop down introduced by HikaShop perhaps I need to do a refresh or something silimair? Attached is the HTML generated by the component and my jQuery code to attempt to populate it.

Can someone please show me how to populate the drop down?

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #168454

Hi,

This kind of dropdowns are introduced by Joomla.
I guess that you will have to remove the generated div with the id "deliverydate_chzn" and then do a ".chosen()" on your select in order to regenerate the new dropdown with the desired values.

Something like:

jQuery('#deliverydate_chzn').remove();
jQuery('#deliverydate').removeClass('chzn-done').chosen();

Please Log in or Create an account to join the conversation.

  • Posts: 62
  • Thank you received: 0
10 years 9 months ago #169158

Xavier wrote: Hi,

This kind of dropdowns are introduced by Joomla.
I guess that you will have to remove the generated div with the id "deliverydate_chzn" and then do a ".chosen()" on your select in order to regenerate the new dropdown with the desired values.

Something like:

jQuery('#deliverydate_chzn').remove();
jQuery('#deliverydate').removeClass('chzn-done').chosen();


That put me on the right path. After doing the population all that you need to do is:

Pre Chosen 1.0: $('.chzn-select').trigger("liszt:updated");
Chosen 1.0 $('.chosen-select').trigger("chosen:updated");

And in my case I had to use Pre Chosen 1.0

Please Log in or Create an account to join the conversation.

Time to create page: 0.067 seconds
Powered by Kunena Forum