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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Adding Parsys in loop in sightly

pradeepdubey82
Level 4
Level 4

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
pradeepdubey82
Correct answer by
Level 4
Level 4

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
pradeepdubey82
Correct answer by
Level 4
Level 4

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

Ratna_Kumar
Community Advisor
Community Advisor

Hi Pradeep,

Please mark it as solved 🙂

Thanks.
Ratna,

pradeepdubey82
Level 4
Level 4

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

Feike_Visser1
Employee
Employee

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