Expand my Community achievements bar.

SOLVED

Is using HTL to remove last separator/comma possible?

Avatar

Level 4

Dear community,

 

I'm using multifield and a sling Model (for loop) to dynamically add content on my footer as below:

 

multi.pngfooter.png

 

I wonder if it's possible to remove last separator (which is written in my html file) with HTL?

Or this can only be done in the Sling Model?

 

HTL.png

 

Thanks in advance!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

yes, In brief: check for the last child in the list and don't display it.

<sly data-sly-test="${!itemList.last}"><span class="link-separator"></span></sly>, here I am displaying the separator only if the list item is not the last one. 

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

yes, In brief: check for the last child in the list and don't display it.

<sly data-sly-test="${!itemList.last}"><span class="link-separator"></span></sly>, here I am displaying the separator only if the list item is not the last one. 

Avatar

Level 4

Thank you @B_Sravan, it works and am getting more ideas about how to use data-sly-test