Hi ,
I want to create a "Dynamically populate selection dropdown in a dialog with a datasource using JSON" have any perfect reference please ping me how to do step wise function.
Solved! Go to Solution.
Views
Replies
Total Likes
Check out ACS commons Generic List [1]
[1] https://adobe-consulting-services.github.io/acs-aem-commons/features/generic-lists/index.html
Check out ACS commons Generic List [1]
[1] https://adobe-consulting-services.github.io/acs-aem-commons/features/generic-lists/index.html
Hi @keshava219
Checkout this video, try latest ACS commons package.
https://www.youtube.com/watch?v=PqHOgKBs30U
Hope this will help!
Please check https://aemlab.blogspot.com/2019/07/aem-touch-ui-dropdown-from-json.html
@keshava219 You can create datasource node structure with sling:resourceType of datasource as sling:resourceType (String) = /bin/dropdownList ( i.e. Path of the servlet implementing the data source for dynamic value). It will give the desire result of a dynamic dropdown as you can see below the screenshot.
For DataSource Servlet (/bin/dropdownList) Implementation you can refer to below articles:
https://redquark.org/aem/day-17-granite-datasources/
http://www.sgaemsolutions.com/2019/01/dynamically-populate-drop-down-values.html
Hope this helps
Thanks
hi @ShaileshBassi,
Thanks, this was helpfull But I want to pass along with parameters as well to servlet from dialog which author mention
Example
On dialog i have numerical number i want to pass to servlet this value possible?
Views
Replies
Total Likes
Hi @keshava219
you should write dialog js so that wehn you change on dialog level at that time only dropdown value get changed (at the same time )---> Js will help you on that...
But if you want to pass the value in servlet , it can be done like below mentioned code snippet . but this would not be "on the fly" ..Suppose value is 5 .after dialog submission only your dropdown items count would be 5 ..when you made it suppose 6 then submit dialog again and open it again then only 6 items you will be able to see ..In backedn it will work like that
as you registered servlet with path ...just read the dailog values of your field "Number of Articles to Show " in your servlet
smething like this you can do
then you can use this value and put the logic to just those many dropdown selection items .
String cmptOnPage = req.getPathInfo().toString();
String actualPath = cmptOnPage.substring(cmptOnPage.lastIndexOf("/content"), cmptOnPage.length());
ValueMap actualResourceValueMap = req.getResourceResolver().getResource(actualPath).adaptTo(ValueMap.class);
String dialogVlaues =actualResourceValueMap.get("text", String.class);
logger.info("dialogVlaues path "+dialogVlaues);
/** ------------------------------------------------------------
Views
Replies
Total Likes
Views
Likes
Replies