Undo in a Repeating Section

You can delete an entire row of a repeating section, by clicking the Modify button then a Delete button. This might be risky, since it can’t be undone.

Or can it?

The Remove Event

One thing that can easily be overlooked is the remove event of repeating sections People often do this:

on('change:repeating_example', () => {Code language: PHP (php)

But there are a lot of situations you also want to do this:

on('change:repeating_example remove:repeating_example', () => {Code language: PHP (php)

When you remove a row, you might need a sheet worker to run again. Imagine your sheet worker is being used to calculate the effec of buffs, or the total weight carried. Those might very often need recalculation after the row is removed.


But another thing becomes possible when you are monitoring removals:

on('remove:repeating_example', eventInfo=> {
});Code language: JavaScript (javascript)

When you remove a row, and only then, a removedInfo property is created. This contains an object with a separate property for eery removed value. If you removed a row from repeating_example conatined a sword, removedInfo might contain:

"repeating_example_-NZBLeO8JwWewgX-7syD_name": "Sword"
"repeating_example_-NZBLeO8JwWewgX-7syD_number": "1"
"repeating_example_-NZBLeO8JwWewgX-7syD_weight": "4"

An enterprising sheet author might have the remove item automatically populate an undo attibute (or a set of attributes), so players coud undo their last deletion in each repeating section.


I’ve never used this feature, though maybe I should. It definitey has potential, if your sheet author is willing to put in the work and it’s neat that it exists.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.