HTL data-sly-test for listChildren

659 Views Asked by At

Is there a way to test if listChildren will return anything? Something along the line of: <sly data-sly-test=${item.listChildren.size > 0} />

1

There are 1 best solutions below

0
Vlad On BEST ANSWER

Assuming this is a followup of Sightly Implicit Objects, the listChildren method will return an Iterator. You can check it’s not empty by calling its hasNext method:

<sly data-sly-test=“${item.listChildren.hasNext}”>