Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Aem dialog drop-down option from api in 6.5

Avatar

Level 2

Hi Team, 

We want to create a dilog field where we can load drop-down option of api response when dilog is opened can we try this from datasourse or data source call backend each time when opened?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
6 Replies

Avatar

Community Advisor

Hi @ashishm85330433 

 

You can create a clientlib with some custom js like this:

 

(function (document, $) {
    "use strict";
    $(document).on("foundation-contentloaded", function (e) {
        // do your custom code here
    });
})(document, Granite.$);

 

Then call the clientlib in the component dialog xml using "extraClientlibs" property. This JS will called when you open the dialog.

 

NB. There are some other event available also like you want to do some thing on submit of a dialog.

 

Thanks.

Avatar

Community Advisor

@ashishm85330433 DataSource is the best suggested approach to load dropdown options as we can make secure API call to third party system. Its easy to maintain the tokens and other API configuration in backend approach.

We can go ahead with @AsifChowdhury approach, if the 3rd party is public and doesn't require any token to access the same. In this we may not require whitelisting to access API.

Avatar

Correct answer by
Community Advisor

Avatar

Administrator

@ashishm85330433 Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni