Expand my Community achievements bar.

AEM: Populate a drop-down with a data source | AEM Community Seeding

Avatar

Administrator

BlogImage.jpg

AEM: Populate a drop-down with a data source by Theo Pendle

Abstract

How to create a generic, re-usable data source system to supply the data for your drop-downs and other widgets

When creating components or modifying other parts of AEM’s TouchUI, it is sometimes necessary to use select widgets containing a number of options. So how can we do this and what is the best way, especially if we have many large lists?

This can be done in the simplest way by listing each item as a node in the JCR, where each item node contains a text (label seen in the select widget) and a value (actual value saved in the JCR) property.

This works well for small lists, but is not the most effective way to deal with larger lists, especially if they are expected to change in the future!

Adobe-recommended
This brings us to Granite data sources, as documented here, which allow us to programmatically create lists of items which can be used by our widgets. Adobe has a (somewhat outdated) tutorial which still relies on JSPs, but covers the basics: you replace the items node by a datasource node, which calls a Java model. This model adds a each entry as a ValueMap to the request.

Read Full Blog

AEM: Populate a drop-down with a data source

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies