Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Get reference to drop down in Coral UI without duplicates

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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#retrievingA...

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

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#retrievingA...