Aem dialog drop-down option from api in 6.5 | Community
Skip to main content
New Participant
February 16, 2024
Solved

Aem dialog drop-down option from api in 6.5

  • February 16, 2024
  • 4 replies
  • 1573 views

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?

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

4 replies

kautuk_sahni
Employee
February 21, 2024

@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
arunpatidar
New Participant
February 16, 2024
Imran__Khan
New Participant
February 16, 2024

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

New Participant
February 16, 2024

Thanks @imran__khan but how datasourse will call servlet.

Imran__Khan
Imran__KhanAccepted solution
New Participant
February 21, 2024
AsifChowdhury
New Participant
February 16, 2024

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.