- Posts: 62
- Thank you received: 0
Populating a custom field drop down via jQuery....
12 years 3 months ago #168428
by TheEdge
Populating a custom field drop down via jQuery.... was created by TheEdge
-- 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?
-- 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?
Please Log in or Create an account to join the conversation.
12 years 3 months ago #168454
by Xavier
Replied by Xavier on topic Populating a custom field drop down via jQuery....
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:
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:
Code:
jQuery('#deliverydate_chzn').remove();
jQuery('#deliverydate').removeClass('chzn-done').chosen();
Please Log in or Create an account to join the conversation.
12 years 3 months ago #169158
by TheEdge
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
Replied by TheEdge on topic Populating a custom field drop down via jQuery....
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:Code: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.069 seconds