Get reference to drop down in Coral UI without duplicates | Community
Skip to main content
jacob_m1
Level 2
March 11, 2016
Solved

Get reference to drop down in Coral UI without duplicates

  • March 11, 2016
  • 2 replies
  • 1650 views

Hi experts,

Can anyone help me to figure this out. I have drop down in touch ui and populating some values via datasource.

Now when adding listeners to it, how can I get reference to this field.

I used

 var list= new CUI.Select({
            element: $("[name=./list']").closest(".coral-Select")
  });
 But this does add duplicate values to drop down.

In order to remove  duplicates I tried to use: list._selectList.children().not("[role='option']").remove();  but it didnt worked. Still duplicates are present.

Share your thoughts guys....

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by edubey

You can get reference via: var ref = $("[name='./myfield' ]").closest(".coral-Select");

Documentation: https://docs.adobe.com/docs/en/aem/6-1/ref/coral-ui/docs/2.17.0-granite-004/scripts.html#retrievingAComponent'sJavaScriptInstance

2 replies

jacob_m1
jacob_m1Author
Level 2
March 11, 2016

Its in AEM 6.1

edubey
edubeyAccepted solution
Level 10
March 13, 2016

You can get reference via: var ref = $("[name='./myfield' ]").closest(".coral-Select");

Documentation: https://docs.adobe.com/docs/en/aem/6-1/ref/coral-ui/docs/2.17.0-granite-004/scripts.html#retrievingAComponent'sJavaScriptInstance