I need to sort a Repeater and then update each row in the sorted order. I had assumed that the Item.index for each row would change with the sort but this doesn’t seem to be true. Whatever the original order of the rows is those Item.indexes seem to be ‘stuck’ to their rows despite the sort order. This being the case I cannot think of a way in which I can process the table in its sorted order!
In the attached example, the repeater has 3 columns: Index, Data and Random. OnItemLoad sets ‘Index’ to Item.index. Try the following:
-
Click UPDATE. This populates the RANDOM column with random number.
-
Click APPLY SORT. This sorts the table by the values in RANDOM. Note that the Item.index values in the INDEX column seem to correspond to the sorted order.
-
Select an option from the ‘Filter’ dropdown. This applies a filter ‘Item.index = selected option’ to the table.
You will see that, instead of showing the row which has that index number in the INDEX column, it shows the item whose ‘original’ index (i.e. before sorting) matches the selected option.
This suggests that the original indexes are persistent. If this is so, how can I step through the table in its sorted order to update each row according to its sorted position?
20181017 Repeater Sort Test.rp (64.0 KB)