Sightly AEM -size or length of array in siglty | Community
Skip to main content
Prince_Shivhare
New Participant
Sep 14, 2017 10:55 AM UTC
Solved

Sightly AEM -size or length of array in siglty

I want get the length or size of my list in aem sightly,so is there any property like size to get the total count of elements in the list?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Feike_Visser1
Feike_Visser1Accepted solution
Employee
Sep 14, 2017 2:46 PM UTC

you can use the methods that you have in Java for the concerned object.

Like

${ myArray.length}

${ myList.size }

3 replies

VeenaVikraman
New Participant
Sep 14, 2017 3:45 PM UTC

Yes Prince. , Please try the way Feike has mentioned here.

Translate
Feike_Visser1
Feike_Visser1Accepted solution
Employee
Sep 14, 2017 2:46 PM UTC

you can use the methods that you have in Java for the concerned object.

Like

${ myArray.length}

${ myList.size }

Translate
AnkurAhlawat-1
Level 6
Sep 14, 2017 11:18 AM UTC

Modifying my comments:-

Very well said by Feike , i tried by creating a small sample in my local and able to get size of list.

${<useClassObject>.<ListMethodName>.size}

For Example:-

In java:-

public List getTestList() {

return testList;

}

In HTML:-

<sly data-sly-use.useClassObj = "com.ups.components.use.ArrayListClassUse">

Size of List:- ${useClassObj .testList.size}

</sly>

Hope it helps. Thanks Feike for quick response.

Translate