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

Sightly - List of Parsys

Avatar

Level 3

I have a case where I need to create a variable number of parsys in a Sightly component.  Here's the code I am currently trying:

<div data-sly-list="${var.List}"> <div class="${item}"> <div data-sly-resource="${'field' + itemList.count @ resourceType='wcm/foundation/components/parsys'}"> </div> </div> </div>

which is dying because it cannot parse the "+ itemList.count".  If I take that part off, it only shows one of the two (or three) parsys as editable, but if I add a component to that parsys it will show up the number of times selected.  Any ideas how to separate these parsys from each other?  I would prefer to do it as part of a list, but could be persuaded otherwise if someone provided a good enough solution.

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Employee
  1. Can you try this?
  2.  
  3. <div data-sly-list="${var.List}">
  4. <div class="${item}" data-sly-test.resourcePath="${ '{0}{1}' @ format=['field',itemList.count]}">
  5. <div data-sly-resource="${ resourcePath @ resourceType='wcm/foundation/components/parsys'}">
  6. </div>
  7. </div>
  8. </div>

View solution in original post

5 Replies

Avatar

Level 10

Our eng team said that + operation is not supported in sightly. Use @format instead.

Avatar

Level 3

@smacdonald2008 - Do you have an example?  I have done several google searches and not finding any examples of this syntax.

Avatar

Correct answer by
Employee
  1. Can you try this?
  2.  
  3. <div data-sly-list="${var.List}">
  4. <div class="${item}" data-sly-test.resourcePath="${ '{0}{1}' @ format=['field',itemList.count]}">
  5. <div data-sly-resource="${ resourcePath @ resourceType='wcm/foundation/components/parsys'}">
  6. </div>
  7. </div>
  8. </div>

Avatar

Level 3

@Fieke - that worked perfectly.  Thank you for your help!