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

Dynamic tables - numbering of rows

PatK
Registered: Jul 16 2009
Posts: 1
Answered

Hi all, I'm hoping someone can help me out there. I have created a dynamic table with 'add' and 'delete' buttons. My problem is when I add a new row I would like the row and subsequent rows to be numbered automatically (in the left-hand column). I'm not too sure of the actual scripting involved.
Thanks in advance for your help.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Accepted Answer
To do this you'll need to add a "Line Number" field to the line. Add this script to the initialize event for the field:

this.rawValue = (this.parent.index + 1).toString();

This code will add the line number at the time the line is added to the table. If lines will be deleted or moved at some later time you will need to add an IndexChange event script as well if you want the numbers to be in order.

I've got an example of line numbering somewhere on this site, but you'll have to look around. I think it might be attached to this eseminar: Extending LC Forms


Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script