Problems when getting the index or count on data-sly-list
Hi,
I'm using sightly with a Java class annotated with @Model.
And the class has a method that return a list with objects. Like List<CarouselPage> pages;
I can iterate over the list and get the object properties, but when I try ${itemList.count} or ${itemList.index} it throws an error:
Caused by: io.sightly.java.compiler.CompilerException: Compilation errors in apps/<mysite>/components/content/carousel/SightlyJava_carousel.java:
Line 79, column 4018 : Cannot invoke equals(boolean) on the primitive type long
at io.sightly.java.compiler.SightlyCompileServiceImpl.compileJavaResource(SightlyCompileServiceImpl.java:187)
at io.sightly.java.compiler.SightlyCompileServiceImpl.compileSource(SightlyCompileServiceImpl.java:132)
I thought it was a problem wiht List itself, then I tried returning the iterator instead of the List, but I got the same problem.
But when I try with the iterator returned by currentPage.listChildren the index and cound works.
Did you guys already faced this problem?
Follow the code:
<ul data-sly-list="${currentPage.listChildren}"> <li>${itemList.index} - ${item.title}</li> </ul> <ol class="carousel-indicators" data-sly-list="${carousel.pages}"> <li data-target="#main-slider" data-slide-to="${itemList.index}" class=""></li> </ol>