Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Dynamic table numeration (removeInstance problem)

Avatar

Level 1

Hello guys,

I'm trying to create a dynamic table that has a column with automatic numeration (some sort of index). Each row has a add / remove button and everytime I add / remove a row a want to recompute the index column because i want it to be ordered.

Everything works fine when I add rows to the table but when i try to remove a row I cannot recompute the rows indexes, Livecycle throws back a very generic exception "GeneralError: Operation Failed".

The code I'm using is as follows:

form1.#subform[0].Table1.Row1.Subform1.Add::click - (JavaScript, client)

var rowNum = this.parent.parent.index + 1;

this.parent.parent.instanceManager.addInstance(rowNum);

for (i = 0; i < this.parent.parent.instanceManager.count ; i++){

     xfa.resolveNode("Row1[" + i + "]").Cell2.rawValue = "" + (i + 1);

}

form1.#subform[0].Table1.Row1.Subform1.Remove::click - (JavaScript, client)

try

{

    var rowNum = this.parent.parent.index;

    this.parent.parent.instanceManager.removeInstance(rowNum);

     for (i = 0; i < this.parent.parent.instanceManager.count ; i++){

         xfa.resolveNode("Row1[" + i + "]").Cell2.rawValue = "" + (i + 1);

     }

}

catch(err)

{

    app.alert(err); 

}

I've noticed that from the moment I do a removeInstance, every operation I do at the table level gives me that exception. I am a Livecycle newbie so it is possible that I'm missing something very basic here...

If you want to take a look of what I'm talking about I have shared it here http://wikisend.com/download/616276/test_dynamic_numeration.pdf

Any help will be highly appreciated

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 1

Ok,

I've found a solution using the event layout:ready here

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

One problem less

View solution in original post

1 Reply

Avatar

Correct answer by
Level 1

Ok,

I've found a solution using the event layout:ready here

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

One problem less