Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Sightly if else condition for the list in AEM

Avatar

Avatar
Level 1
chandramohanred
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
View profile

Avatar
Level 1
chandramohanred
Level 1

Likes

0 likes

Total Posts

5 posts

Correct Reply

0 solutions
View profile
chandramohanred
Level 1

22-04-2021

<div class="xyz">
<sly data-sly-list.childPageLvl2="${childPageLvl1.childPages}">
---Iterate and print all child pages---

</sly>
-----View All--- (after child pages are printed then it print 'view all" as a last line)
</div>

 

Hi Team,

As per above code, it print all 'child pages of root page' and then it prints 'View All' at last
if 'child pages are not available for root page' it only prints 'View All' at last.


My requirement is,
It should print 'View All' only if 'child pages of root pages is available'.
it should not print 'View All' at last if child pages are not available for root page. (like if else condition)


Please suggest?

 

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
Level 7
KiranVedantam1992
Level 7

Likes

174 likes

Total Posts

183 posts

Correct Reply

55 solutions
Top badges earned
Springboard
Give Back 5
Ignite 1
Affirm 50
Validate 1
View profile

Avatar
Springboard
Level 7
KiranVedantam1992
Level 7

Likes

174 likes

Total Posts

183 posts

Correct Reply

55 solutions
Top badges earned
Springboard
Give Back 5
Ignite 1
Affirm 50
Validate 1
View profile
KiranVedantam1992
Level 7

01-06-2021

Hi @chandramohanred,

 

Please use the below code:

<sly data-sly-test="${childPageLvl2.size > 0}"> View All </sly>

 

Hope this helps.

 

Thanks,

Kiran Vedantam.

Answers (0)