That's not a problem. Just run a for loop in reverse and add or remove the rows as needed.
Given you have a table "Table" with a repeatable row "Row" with a check box "CheckBox" in it, the script can look like this.
var oRows = Table.resolveNodes('Row[*]'), // resolve existing rows
i = oRows.length - 1; // declare instance variable
// Loop through all rows backwards
for (i; i >= 0; i -= 1) {
var oRow = oRows.item(i); // reference the nth row
// Check the checkbox in the row.
// If active, add row below
if (oRow.CheckBox.rawValue === 1) {
Table._Row.insertInstance(i + 1, true);
oRow.CheckBox.rawValue = 0;
// Otherwise remove current instance
} else {
Table._Row.removeInstance(i);
}
}