How do I copy a table with expandable rows to another table?

MelJen

05-08-2015

I have a page containing fields in a table with Add and Delete buttons to add and delete rows:


 

I want to copy the fields table into another table on a page that will be printed:

Can anyone help me with the scripting?

Accepted Solutions (0)

Answers (1)

Answers (1)

areddingICF

07-08-2015

I had a similar table where I was archiving rows "deleted" from one table and moving them to another table.  I used this code on the click event of the delete button:

(this code adds a new row to the second table and copies the data from the current row to the old row)

var newRow = this.resolveNode('Page2.Table1._Row1').addInstance(1);

if (xfa.host.version < 😎 { xfa.form.recalculate(1);}

newRow.Name.rawValue = this.resolveNode("Name").rawValue;

newRow.Type.rawValue = this.resolveNode("Type").rawValue;

newRow.Status.rawValue = this.resolveNode("Status").rawValue;

I also used a variation of this on the exit event of the last field in each row to add a row to a table and copy the data over.  If you do that though, it adds a new row every time you exit the field - you would have to write more code to check if the data changed before you add the row and probably something else to address deleted rows if that's an issue for you.  Hope it helps.