Repeater - problem with counting (Sort + Delete Rows)

repeater-widget

#1

Hi! Need your help.
Here is the table: https://jq5bpc.axshare.com
Separately, sorting by Value (by clicking columns title - Value) and deleting (when you click on the cog icon and click on Delete) works correctly, but if I need to first sort the columns, and then delete (or vice versa, delete first, and then sort out), then the count gets lost.Example.rp (142.4 KB)

Please, help me to solve this problem!


#2

Hi @Ester!

After some more digging, there is actually a way to get the Sort interaction to work ascending/descending using [[Item.index]]. What you can do is set the text on the Value cell equal to the following for the descending sort:

[[TargetItem.Repeater.itemCount - TargetItem.index + 1]]

What this is doing is getting the item count of the repeater and then subtracting the index of those numbers plus a value of 1 (otherwise, it’ll start at 0).

For the ascending sort, set the text on the Value cell equal to simply:

[[TargetItem.index]]

The very last part is splitting up your Sort event into two so that there’s one conditional case for the ascending sort and the other for the descending sort, which could be achieved by using a global variable counter.

I’ve edited your file to demonstrate this. Lmk if you have any questions. :slight_smile:

Example_EDIT.rp (139.8 KB)


Adding multiple sorts to a repeater