gkidd
gkidd

Reputation: 199

How to get handle of the last document in repeat control

I have a repeat control that cycles through documents in a view and in a computed field I return something like:

<li>Link here</li>

I need a method or a way to get the last index and when it is reached the computed field should return:

<li class="last">Last link here</li>

Something like:

if(index.lastDoc()){
    return "<li class="last"></li>
    } else {
    return "<li></li>
    }

Upvotes: 0

Views: 197

Answers (1)

gkidd
gkidd

Reputation: 199

Ok I got it, I was doing this all along but I had no idea that the Index is starting from 0. All I had to do is add one.

var docs = servicesData.getAllEntries().getCount();

if (repeatCount + 1 == docs)

Upvotes: 1

Related Questions