Highlighted

HTL data-sly-test

ariellea4070516

14-12-2018

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

Replies

Highlighted

Feike_Visser1

Employee

16-12-2018

You can call any method that has no arguments in data-sly-test.

In your case check if your item has these methods.

Highlighted

ariellea4070516

17-12-2018

Thank you all! Your answers pointed me to a solution. I was able to test whether or not the item had children this way:

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