Expand my Community achievements bar.

is there any way to iterate two list in sightly with below condition

Avatar

Level 2

<div data-sly-repeat.item="${items}">
 i=${itemList.count}

<div data-sly-list.value="${variableObject.iconImage}">

 j=${valueList.count}

<div data-sly-test.my=[${itemList.count}=${valueList.count}]>
<span class="cmp-accordion__icon nn-accordnion__icon__chevron">
<img src="${value.setImageIcon}" width="44" height="44" alt="${value.altText}">
</span>

</div>

</div>

 

.

is there any way to iterate like if(i==j) then only <span> image should come ? please help i have considered i and j in above code those are count of both list.

1 Reply

Avatar

Level 1

Hi @ShivamSh1,

 

I think the below code will work. I haven't tested it. But you can try it on your local.

<div data-sly-repeat.item="${items}">
    <sly data-sly-list.value="${variableObject.iconImage}">
        <sly data-sly-test.isMatch="${itemList.count == valueList.count}">
            <span class="cmp-accordion__icon nn-accordnion__icon__chevron">
                <img src="${value.setImageIcon}" width="44" height="44" alt="${value.altText}">
            </span>
        </sly>
    </sly>
</div>

 It is basically comparing the count of both list's count when both are equal then your span will be displayed.