Avatar

Level 10

Hi Harry,

The parameter for the removeInstance is the instance number that you want to delete. This is based on a zero numbering system, so the first row is instance number '0'. In a table you would access the instance number of the row that the delete button is in by using

_Row1.removeInstance(this.parent.index); 

The exact script would depend on your naming convention.

If you explore this example you will see that the remove instance in one table fires the click event in a button in a second table. Example here:

https://acrobat.com/#d=pQcBT5qhgi8Ebx75H0r5yQ

// '_' is shorthand for instanceManager, eg '_Row1'

// this.parent.index tells instanceManager to remove

// the row that the button is in.


var vCurrentRow = this.parent.index;

xfa.resolveNode("page2.Table2.Row1[" + vCurrentRow + "]").deleteBtn.execEvent("click");

page1.Table1._Row1.removeInstance(vCurrentRow);

Note that the parameter for the addInstance is 1/true or 2/false, which relates to true=merging the new instance with the data model. 

Hope that helps,

Niall