Expand my Community achievements bar.

SOLVED

Adding Parsys in loop in sightly

Avatar

Level 7

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 7

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 7

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 7

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.