Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Deleting Relative Instance of Table Row

Avatar

Level 2

In Table1, Row1 is a repeatable row with an autonumber field and add/delete buttons.  When you click "add" there is another row added to Table1 AND Table2, with the same autonumber.  When you click "delete" I need it to delete the same relative row in both tables.

So if the delete button for Table1.Row1[2] is clicked, I want it to delete Table1.Row1[2] and Table2.Row1[2].  Right now it will delete Table1.Row1[2] and Table2.Row1[0].

I know it needs to loop and count, but I'm not sure how to incorporate that into the delete action for two separate tables.

Here's my code so far:

this.resolveNode('Table1._Row1').removeInstance(this.parent.parent.index);

this.resolveNode('Table2._Row1').removeInstance(this.parent.index);

if (xfa.host.version < 8) {

          xfa.form.recalculate(1);

}

1 Accepted Solution

Avatar

Correct answer by
Level 10

I think the problem is you use the wrong index for the second table.

Try the following.

this.resolveNode('Table2._Row1').removeInstance(this.parent.parent.index);

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

I think the problem is you use the wrong index for the second table.

Try the following.

this.resolveNode('Table2._Row1').removeInstance(this.parent.parent.index);

Avatar

Level 2

Such a simple error.  Thank you!