Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

Parsys included within a loop in sightly coming up only once, even though the looping is working fine.

Avatar

Level 8

Hi All,

Reffered to a post written by Feike Visser http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage... and am making use of the same javascript function.

In my html[AEM 6.2], using the below snippet :

<sly data-sly-use.itemCount="itemCount.js" data-sly-unwrap />

<ul data-sly-list="${itemCount}">
        <div data-sly-resource="${ 'par' @ resourceType='foundation/components/parsys'}"></div>
    </ul>

#1] Tried various combinations to the line "<div data-sly-resource="${ 'par' @ resourceType='foundation/components/parsys'}"></div>", but no  luck.

Even though the loping is happening fine for this column control component[which we are working on], say looping is happening 5 times, the parsys appears only once in one of the column and not 5[which is expected].

Not sure why is this not working.

Any thoughts here would be helpful

1 Accepted Solution

Avatar

Correct answer by
Employee

what if you use @ format, to have different parsys? So you have par0. par1 etc.

<ul data-sly-list="${itemCount}">

        <sly data-sly-test.parResource="${ 'par{0}' @ format[itemList.index}"/>
        <div data-sly-resource="${ parResource @ resourceType='foundation/components/parsys'}"></div>
    </ul>

View solution in original post

9 Replies

Avatar

Employee

But you have then 5 times the same parsys?

<div data-sly-resource="${ 'par' @ resourceType='foundation/components/parsys'}"></div>

Avatar

Level 10

Why do you want to loop and add parsys - typically when you loop in HTL- you are adding content from a bean or Java collection.  I am not sure why you want this? 

For example -- 

https://helpx.adobe.com/experience-manager/using/htl_repeat.html

Notice each loop - we are writing out the contents of a LIST object that renders the content to a web page. You should write out content - not a parsys. 

Avatar

Level 8

Hi Scott/Feike,

Thank you for your reply. Basically, we need to create a column control component, wherein there is no limit on the number of columns that can be present[this is a client requirement.]

 I am trying to convert the jsp code in this forum post[https://forums.adobe.com/thread/1014789] to sightly and this is where I am facing this issue.

If I try directly with the jsp code, it seems to be working.

Any thoughts/reference code will e really helpful.

Avatar

Level 10

I will search for this - all the examples I have ever done/seen - we are writing out data via HTL as opposed to a parsys.

Avatar

Correct answer by
Employee

what if you use @ format, to have different parsys? So you have par0. par1 etc.

<ul data-sly-list="${itemCount}">

        <sly data-sly-test.parResource="${ 'par{0}' @ format[itemList.index}"/>
        <div data-sly-resource="${ parResource @ resourceType='foundation/components/parsys'}"></div>
    </ul>

Avatar

Level 8

Hi Feike,

Thank you for your reply.

Will check on this and keep you posted on the outcome.

Avatar

Level 8

Hi Feike,

Thanks a ton for your reply.

It works nowsmiley.

Avatar

Level 1

i need parsys for Accordion component. I need parsys in loop as how many times I have added multifield. Is there any option to repeat parsys?