Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Nivel 1
Nivel 2
Iniciar sesión en la comunidad
Iniciar sesión para ver todas las insignias
Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Hi
I have the Sling model in that i have list like below
public List<customList> getCustomProducts() {
return customProducts;
}
When i tried to identify the last item of list like below
<sly data-sly-list.product="${productModel.customProducts}">
<a href="${product.link}"><strong> ${product.name}</strong> </a>
<sly data-sly-test="${!product.last}">
<span class="separator">|</span>
</sly>
</sly>
in above code <span class="separator">|</span> is printing for last item as well
if list contains 3 items the | should print 2 times like below
product1 | product2 | product 3
But its printing like
product1 | product2 | product 3 |
can some help me how to identify the last item from list so that or how i can achieve this
¡Resuelto! Ir a solución.
Vistas
Respuestas
Total de me gusta
Can you please try below and see if this works.
<sly data-sly-test="${!productList.last}">
<span class="separator">|</span>
</sly>
Vistas
Respuestas
Total de me gusta
Can you please try below and see if this works.
<sly data-sly-test="${!productList.last}">
<span class="separator">|</span>
</sly>
Vistas
Respuestas
Total de me gusta
Vistas
Respuestas
Total de me gusta
Hello @manikanthar1295 ,
You need to use List keyword after the object(product) name. then it will be productList. https://www.aemtutorial.info/p/htl-sly-list.html
BTW you can also use the following properties if you need.
Vistas
Respuestas
Total de me gusta
Hi @manikanthar1295 ,
You can use last property as below.
<ul data-sly-list="${currentPage.listChildren}">
<li data-sly-test="${itemList.last}">${item.title}</li>
</ul>
Please check below for more details in HTL.
https://www.aemtutorial.info/p/htl-home.html
https://www.aemtutorial.info/p/htl-sly-list.html
Regards,
Shiv
Vistas
Respuestas
Total de me gusta
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas