Expand my Community achievements bar.

SOLVED

Autonumber for several fixed rows

Avatar

Level 3

I have often used the autonumber for dynamic row instances with no problem, but now have a problem where my table starts with 3 rows with different content, and the user needs to be able to add and delete rows, at the same time maintaining the autonumbering.

I created the table with three rows, and each row has the same name (Table1.Row) - I set the Binding to Repeat row with Initial Count set to 1 - no Minimum count

On a text field in that row, I use the Calculate event with

 

var vIndex = ["(a)", "(b)", "(c)"];
var i = this.parent.index;

this.rawValue = vIndex[i];

This produces rows with (a), (b) and (c)

I have a delete button for each row - Click event 

Table1.Row.instanceManager.setInstances(0)

- this deletes the row I click on

All good so far, but the autonumbering does not recalculate the remaining rows when I delete one.

Does anyone have an idea of how I can get the remaining rows to recalculate? I tried putting

 

xfa.form.recalculate();

in various events, but no joy

1 Accepted Solution

Avatar

Correct answer by
Level 3

Oh well - found my own solution. Same as the above, but

"On a text field in that row, I use the Layout:Ready event with

   

var vIndex = ["(a)", "(b)", "(c)"];
var i = this.parent.index;

this.rawValue = vIndex[i];

This produces rows with (a), (b) and (c)  - and the deletion works to remove the row and renumber the remaining ones.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 3

Oh well - found my own solution. Same as the above, but

"On a text field in that row, I use the Layout:Ready event with

   

var vIndex = ["(a)", "(b)", "(c)"];
var i = this.parent.index;

this.rawValue = vIndex[i];

This produces rows with (a), (b) and (c)  - and the deletion works to remove the row and renumber the remaining ones.