Expand my Community achievements bar.

SOLVED

in a dynamic table, can instance manager tell the index of current row instance?

Avatar

Level 3

Script Dependencies and "recalculate()"

I follow the example here, and use it to make a dynamic table. The +/- button now work as my Add/Delete row button.

Learnt from the guide, I can use instance manager and add or remove instance of row. Now I want to know which row I'm editing now, so that when there is data in the rows other than the first row, it pops up an alert to remind me to fill in the first row as a preliminary.

Capture.PNG

Code of instance manager that works in my local:

var oTargetSubform = addButton.parent.repeatingTable.repeatingRow; // The subform or table row the controls are intended to manipulate.

var oManager = oTargetSubform.instanceManager; // Get the instance manager.

while I guess the property I should refer to is oManager.index, it always return 0, yet I don't find the definition of "index" in Designer 11 document: Adobe LiveCycle ES4 * instanceManager

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi there,

to be able to know which row you are currently within when editing a field, in any event you can call the index property from the field's parent row... In occurence, you will have to use the parent property to access the row which the field is inside of...

E.g.: this.parent.index -> (1) parent means the field is directly in the row considered as a cell

         this.parent.parent.index -> (2) parents means the field is within a subform in the row

Hope this will help!

View solution in original post

3 Replies

Avatar

Correct answer by
Level 10

Hi there,

to be able to know which row you are currently within when editing a field, in any event you can call the index property from the field's parent row... In occurence, you will have to use the parent property to access the row which the field is inside of...

E.g.: this.parent.index -> (1) parent means the field is directly in the row considered as a cell

         this.parent.parent.index -> (2) parents means the field is within a subform in the row

Hope this will help!

Avatar

Level 3

Cool it works this way! thanks!

Another question following the above:

the row is named repeatingRow.

I'm at the third row, first column.

How do I get to know the value in the first row first column?

I tried:

this.parent.parent.repeatingRow[0]

while I assume this.parent means the current field's parent, the current row; this.parent.parent means the current table/subform;

But it says "undefined".

Avatar

Level 10

To do so, you need to use resolveNode method to access a specific repeated item..

you should start with your table shown below :

E.g.:

It is also possible doing it with parent, but as long as you specify which instance you want to access using resolveNode