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

Re-numbering after a row has been deleted

Gillian
Registered: Jul 10 2007
Posts: 63
Answered

I have a table where Users can add rows as needed. I use the instance manager for this, (.Row1.instanceManager.addInstance(1);). I also have an item# column that sequentially numbers the columns,(this.rawValue = 0 + this.parent.index+1;)
 
The problem is, if a User adds 6 rows, for example, and then deletes row 3, the item column doesn't renumber. The table displays with Row 1,2,4,5,6 displaying.
 
If I delete more a quantity of rows, it subtracts the quantity I deleted and adds from there. So if I added 6 rows, deleted rows 2,3 and 4, the script calculates 6-3=3 and starts adding row 4,5,6, even though rows 1, 5 and 6 are displaying.
 
Can anyone help me out with the proper script?
 
Thanks in advance
Gillian

-Gillian

My Product Information:
LiveCycle Designer, Windows
Niall
Expert
Registered: Apr 26 2006
Posts: 62
Hi,

The script that you have is probably OK (this.rawValue = this.parent.index + 1), just move this script to the layoutReady event. This way when a row is deleted, the layoutReady event fires and all of the item numbers will automatically update.

Hope that helps,

Niall

Hope this helps,

Niall
Assure Dynamics

Gillian
Registered: Jul 10 2007
Posts: 63
When I move it to the layout ready event, it no longer calculates, so no number appears in the column. So your answer did not provide a solution for me. I appreciate that you tried to help, though. Thanks!
-Gillian

-Gillian

Niall
Expert
Registered: Apr 26 2006
Posts: 62
Hi,

Here is a sample with an alphabet index. The numbered index is easier: this.rawValue = this.parent.index +1;. This should work if the objects parent is the repeating element.

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

Here's another one with repeating subforms: https://acrobat.com/#d=tIpEHFadQtSOefZkU9EBfQ

Hope this helps,

Niall
Assure Dynamics

Gillian
Registered: Jul 10 2007
Posts: 63
I think I'll be able to adopt your code to my form. Thanks! Truly appreciate this!

-Gillian