cancel
Showing results for 
Search instead for 
Did you mean: 

Adding rows dynamically in a table

0 Kudos
Hi all,
I need to add rows dynamically in a table. The table has one single empty row initially and, by pressing a button, a new line is added. I am using the
'instanceManager' property of JavaScript, and more specifically the 'addInstance' and 'moveInstance' methods.
The problem is that apparently all rows are linked, which means that if I edit any field of any row, the content is updated in all others rows. What I need is to create empty rows, independent from each other in terms of content.
I am a begginer in Adobe Interactive Forms, so I am following some tutorials and the Adobe LifeCycle Designer Scripting Guide, but at the moment I can't solve this issue. I would much appreciate any help.
Below is the JavaScript code for the 'Click' event of the button that I am using:

var anInstanceManager = data.Bancos.Z_T012.Z_T012K.Contas.Conta.instanceManager;

var newInstance = anInstanceManager.addInstance(1);

var aToIndex = data.Bancos.Z_T012.Z_T012K.Contas.Conta.index + 1;

var aFromIndex = newInstance.index;

anInstanceManager.moveInstance(aFromIndex, aToIndex);

Thanks and regards,
Gonçalo Costa

Accepted Solutions (1)

Accepted Solutions (1)

sandeep_katoch
Contributor
0 Kudos

Hi Goncalo,

It is quiet simple.

Just follow these steps in the tutorial

http://www.saptechnical.com/Tutorials/AdobeForms/Dynamic/Index.htm

If again facing problem do post will surely help.

BR,

Sandeep Katoch

0 Kudos

Hi Sandeep,

I have followed that tutorial actually, but it didn't work for what I needed. In the meantime, I have figured out how to make it work. I had to remove the binding in the object properties so that the rows content was not mirrored anymore.

Furthermore, I had to comment the last 3 lines from the JavaScript code for the button object, because the rows were not inserted in the end of the table, they were inserted always after the first row, pushing the other rows below.

In any case, thanks a lot for your help. I may be posting more questions in the near future.

Regards,

Gonçalo Costa

sandeep_katoch
Contributor
0 Kudos

Glad to hear your issue has been resolved.

Cheers and have a nice weekend...

BR,

Sandeep Katoch

Answers (0)