Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Adding Parsys in loop in sightly

Avatar

Level 6

Hi All,

I need to add parsys in html as many times as my loop runs. Below is my code that is not working.

Parsys is a list with values par1, par2, par3 and so on.

<sly data-sly-list.parsys="${accordian.accordianParsys}" data-sly-unwrap>
        ${parsys}
        <div data-sly-resource="${@path='${parsys}', resourceType='foundation/components/parsys'}"></div>
    </sly>

 

Please advise.

Thanks,

Pradeep

1 Accepted Solution

Avatar

Correct answer by
Level 6

It worked like below 

<sly data-sly-list.parsys="${accordian.accordianSections}" data-sly-unwrap>
        <div data-sly-resource="${@path=parsys, resourceType='foundation/components/parsys'}"></div>
</sly>

smileysmileysmileyyesyesyes

View solution in original post

4 Replies

Avatar

Correct answer by
Level 6

It worked like below 

<sly data-sly-list.parsys="${accordian.accordianSections}" data-sly-unwrap>
        <div data-sly-resource="${@path=parsys, resourceType='foundation/components/parsys'}"></div>
</sly>

smileysmileysmileyyesyesyes

Avatar

Level 10

Hi Pradeep,

Please mark it as solved :)

Thanks.
Ratna,

Avatar

Level 6

How to mark it solved? I couldn't find option 'solved'.

Avatar

Employee

This is also a great use-case for data-sly-repeat, no need for the wrapping <sly> element.