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 6.0 Granite UI dynamic drop down value from servlet

Avatar

Level 3

We are aware how to create a dynamic drop down values from servlet/json in extjs(as per below link)

https://rmengji.wordpress.com/tag/dialog-dropdown-population-in-cq/

Can you please guide us how to achieve similarly in AEM 6.0 using granite ui

Thanks in advance!!

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi,

In Granite UI, this is done using a DataSource. There are a few OOTB examples of DataSources, including: /libs/cq/gui/components/common/datasources/tags, /libs/foundation/components/list/displayasdatasource and /libs/granite/ui/components/foundation/authorizable/selectdatasource. There's an example of a custom DataSource here: https://github.com/Adobe-Consulting-Services/acs-aem-commons/pull/288

Regards,

Justin

View solution in original post

7 Replies

Avatar

Level 10

Right now -- there are no articles or how to articles around this. We know this is an issue and it will be addressed. You can look at the source code for existing components here:

This is formed by a collection of sling components that enable the author to compose a webapp fast. The developer develops components, the author assembles the components to be a webapp. The role of the server-side is to give the hypermedia affordance (markup) to the client.

Currently the components are located in the Granite repository at:

    /libs/granite/ui/components/foundation

Avatar

Correct answer by
Employee

Hi,

In Granite UI, this is done using a DataSource. There are a few OOTB examples of DataSources, including: /libs/cq/gui/components/common/datasources/tags, /libs/foundation/components/list/displayasdatasource and /libs/granite/ui/components/foundation/authorizable/selectdatasource. There's an example of a custom DataSource here: https://github.com/Adobe-Consulting-Services/acs-aem-commons/pull/288

Regards,

Justin

Avatar

Level 3

Could you please let me know how to create custom in Granite UI similar how we create in custom xtype EXT JS ?

Thanks!

Avatar

Level 3

Hi,

I have a similar requirement where I want to populate the Granite Drop down via a servlet. Can you please let me know the solution around it.

Thanks.

Avatar

Employee

Did you look at the DataSource examples?

Avatar

Level 1

If you want to use something a little more lightweight than ACS commons (which is amazing), you can roll your own with a simple jsp:

http://experiencemanaged.com/posts/display-dynamic-content-in-a-touch-ui-granite-dialog-select-field...

This solution allows you to specify which fields to use for key/value right inside your dialog xml.