Expand my Community achievements bar.

Nomination window for the Adobe Community Advisor Program, Class of 2025, is now open!
SOLVED

Dynamic table numeration (removeInstance problem)

Avatar

Former Community Member

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
Former Community Member

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
Former Community Member

Ok,

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

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

One problem less

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----