2

i have 2 tables. Table1 and Table2. Table1 has Button "Add line". On click in both tables are added lines. Tables have the same number of rows. Each row in the first table has a button that deletes the current line. It is necessary that this button deletes the corresponding row in the second table

Script:

//+ GENERATED - DO NOT EDIT (ID:DBE5BAB4-5E5A-461D-A88D-88E626F6B072 CRC:3827021343)
//+ Type: Action
//+ Result2: RemoveInstance("$Node3","currentindex","")
//+ Result1: RemoveInstance("$Node2","currentindex","")
//+ Node3: form1[0].Page[0].Table2[0].Data_row_table2[0]
//+ Node2: form1[0].Page[0].Table1[0].Data_row_table1[0]
//+ Node1: form1[0].Page[0].Table1[0].Data_row_table1[0].Delete[0]
//+ Condition1: Button("$Node1","click")
//+ ActionName: Delete.click
this.resolveNode('Table1._Data_row_table1').removeInstance(this.parent.index);
if (xfa.host.version < 8) {
    xfa.form.recalculate(1);
}
this.resolveNode('Table2._Data_row_table2').removeInstance(this.parent.index);
if (xfa.host.version < 8) {
    xfa.form.recalculate(1);
}
//-

How i can remove both instance?

DrTiBiBo
  • 101
  • 1
  • 5

1 Answers1

1

I have found the solution.

must first delete a row from the second table

form1.Page.Table1.Data_row_table1.Delete::click - (FormCalc, client)
var row_index = $.parent.index
Table2._Data_row_table2.removeInstance(row_index)
Table1._Data_row_table1.removeInstance(row_index)
DrTiBiBo
  • 101
  • 1
  • 5
  • you don't need to delete from the second table first. you just need to store the index in a variable before deleting. – harun Nov 05 '13 at 10:00