Detecting the last repeater row

Hi there, is it possible to detect the last row of a repeater and apply some styling? Each row has a top border, but I want to add a bottom border to the last row only. I’ve applied the styling to the “selected” style, but can’t work out how to set up the Item Loaded interaction to say “if the row item is the last item, then set as selected”. I’m sure this is very easy if you know how. Can anyone help?

Hi,

I would try the following - in the repeater data-set, add a column titled “Selected” and give all rows the value “0” and only for the last row make it a “1”. Then, on itemload add an interaction to set the item as selected only if value of item.Selected is “1”.
I think this should do the trick - if you allow to dynamically add rows/remove rows it would require some more handling. But first see if this answers your requirement.

You can use a Case to do this, in the ‘On Item Load’. There is a repeater test called ‘Is last’ which allows you to apply/show/hide different styles.

There’s a good discussion of it in use here.

1 Like

Great thanks! I’d seen the “isLast” function, but I didn’t realise I could use it with a true/false. Works like a charm!

Thanks