Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

data-sly-list check for the 2nd last item

Avatar

Avatar
Give Back 5
Level 2
angelinek209805
Level 2

Likes

6 likes

Total Posts

25 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 1
View profile

Avatar
Give Back 5
Level 2
angelinek209805
Level 2

Likes

6 likes

Total Posts

25 posts

Correct Reply

0 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back
Ignite 1
Validate 1
View profile
angelinek209805
Level 2

26-04-2019

Based on HTL documentation HTL Block Statements

itemList: Object holding the following properties:

  • index: zero-based counter ( 0..length-1).
  • count: one-based counter ( 1..length).
  • first: true if the current item is the first item.
  • middle: true if the current item is neither the first nor the last item.
  • last: true if the current item is the last item.
  • odd: true if index is odd.
  • even: true if index is even.

data-sly-test="${itemList.last}" -> Check for the last item, however in my use case, I would need to check for the 2nd last item. Is there a ${itemList.count} in reverse order? In CSS, there is selector :nth-last-of-type(-n+2) for last 2 items.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
Ravi_Pampana
MVP

Likes

190 likes

Total Posts

239 posts

Correct Reply

74 solutions
Top badges earned
Establish
Contributor
Shape 1
Ignite 5
Ignite 3
View profile

Avatar
Establish
MVP
Ravi_Pampana
MVP

Likes

190 likes

Total Posts

239 posts

Correct Reply

74 solutions
Top badges earned
Establish
Contributor
Shape 1
Ignite 5
Ignite 3
View profile
Ravi_Pampana
MVP

26-04-2019

For reversing the array list, we can use below in java and use the list in iterating.

Collections.reverse(arrayList)

I used above code in displaying last added property first in multi field

Answers (0)