These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

removeInstance

rpeterson
Registered: Oct 7 2008
Posts: 72
Answered

I am using addInstance and removeInstance to add and remove lines in a table. Adding works flawlessly. Removing takes the first added line... ie., added lines 6, 7, and 8; removes line 6, then 7, then 8. Can anyone provide suggestions as to how to remove the last line first?

Thanks in advance!
rpeterson

rpeterson

My Product Information:
LiveCycle Designer, Windows
radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Add 1 button to the top of the table with this JavaScript

Table._line.addInstance(1); // Adds a row to the end of the table
xfa.form.recalculate(1);and 1 button to the line (row) of the table with this JavaScript

line.removeInstance(this.parent.index); //Removes the current row of the table
xfa.form.recalculate(1);

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

rpeterson
Registered: Oct 7 2008
Posts: 72
Thank you for your response. I have buttons separate from the table (I do not have the room to add them to the table itself). Can I add the JS to the remove button by referencing the line in the same manner that it is referred to in your example? Or maybe make the add button as my first line and the remove button as the very last line, but reference the last data line for removal?

Thx, rpeterson.

rpeterson

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
And example for you

http://www.adobe.com/devnet/livecycle/articles/AddingRemovingTableRows.pdf

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs