Order of Items at Sling context site configuration | Community
Skip to main content
Level 2
Jan 25, 2023 11:00 AM UTC
Solved

Order of Items at Sling context site configuration

Hi Team,

 

We are using Sling context aware config. But we want to arrange order. 

for eg:

@Property(label = "Enter the button Label", description = "Button Label")
String buttonLabel();
@Property(label = "Enter the title1, description = "Enter the title1")
String title2();
@Property(label = "Enter the title, description = "Enter the title")
String title();
@Property(label = "Enter the title1, description = "Enter the title1")
String title1();

 

When we deploy squence is random. How to show title as first attribute then title1, title2, buttonlabel?

TIA

Naina

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
HeenaMadan
HeenaMadanAccepted solution
New Participant
Jan 25, 2023 11:13 AM UTC

You can use "order=n" to @2542150. Below is the example:

@Property(label = "Enter the title, description = "Enter the title", order = 1)
String title();
@Property(label = "Enter the title1, description = "Enter the title1",order = 2)
String title1();
@Property(label = "Enter the title1, description = "Enter the title1",order = 3)
String title2();
@Property(label = "Enter the button Label", description = "Button Label",order = 4)
String buttonLabel();

 Refer https://sunsushil.wordpress.com/2021/05/12/context-aware-configuration-in-aem/ for more details.

3 replies

sravs
New Participant
Jan 25, 2023 11:20 AM UTC

Hi @naina01 ,

 

you can use the "order" attribute at the annotation level where it will define the 

Number to control property order in the configuration editor. The default value will be 0.

ex:

@Property(label = "Enter the button Label", description = "Button Label", order=3)
String buttonLabel();
@Property(label = "Enter the title1, description = "Enter the title1", order=2)
String title2();
@Property(label = "Enter the title, description = "Enter the title")
String title();
@Property(label = "Enter the title1, description = "Enter the title1", order=1)
String title1();

 

Translate
HeenaMadan
HeenaMadanAccepted solution
New Participant
Jan 25, 2023 11:13 AM UTC

You can use "order=n" to @2542150. Below is the example:

@Property(label = "Enter the title, description = "Enter the title", order = 1)
String title();
@Property(label = "Enter the title1, description = "Enter the title1",order = 2)
String title1();
@Property(label = "Enter the title1, description = "Enter the title1",order = 3)
String title2();
@Property(label = "Enter the button Label", description = "Button Label",order = 4)
String buttonLabel();

 Refer https://sunsushil.wordpress.com/2021/05/12/context-aware-configuration-in-aem/ for more details.

Translate
naina01Author
Level 2
Jan 25, 2023 11:46 AM UTC

Its working.

Thanks

Translate