Parsys included within a loop in sightly coming up only once, even though the looping is working fine. | Community
Skip to main content
cquser1
New Participant
February 3, 2017
Solved

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

  • February 3, 2017
  • 9 replies
  • 3722 views

Hi All,

Reffered to a post written by Feike Visser http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manager.topic.html/forum__vejg-hi_all_im_wantt.html 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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Feike_Visser1

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>

9 replies

priyankdave03
New Participant
September 5, 2018

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?

Feike_Visser1
Employee
February 4, 2017

Great! Thanks for the feedback!

cquser1
cquser1Author
New Participant
February 4, 2017

Hi Feike,

Thanks a ton for your reply.

It works nowsmiley.

cquser1
cquser1Author
New Participant
February 4, 2017

Hi Feike,

Thank you for your reply.

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

Feike_Visser1
Feike_Visser1Accepted solution
Employee
February 4, 2017

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>

smacdonald2008
New Participant
February 4, 2017

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.

cquser1
cquser1Author
New Participant
February 3, 2017

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.

smacdonald2008
New Participant
February 3, 2017

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. 

Feike_Visser1
Employee
February 3, 2017

But you have then 5 times the same parsys?

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