Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.
SOLVED

Add rows or columns to a table

Avatar

Level 3

Hi everyone,

I have a form with a table, the table has a header, 2 rows and 15 columns. 4 of the columns have dropdown boxes with data.

I  also have a button(Add a row), I want when the user clicks on the button to add one row at a time.

The newly created row should be the same as the rows above it, meaning :it should have 15 columns, 4 of the columns must have dropdown boxes with data.

Your assistance will be highly appreciated.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Can you share or email the form? I have sent a pm.

Niall

View solution in original post

8 Replies

Avatar

Level 10

Hi,

The easiest is to set up a repeating row with all of the components that you want. Then when the user clicks to add a new row, it will include all of the dropdowns etc. in the new row.

A sample is here: https://acrobat.com/#d=tdpzltrl25yU2PkvgaQO9w

Hope that helps,

Niall

Avatar

Level 3

Thanks Niall, I tried what you suggested & looked at the example, but still nothing happens when I click the button,

My table is inside a flowed subfomr & I've checked Repeat Table for Each Data Item and under the cliked event is this code:

TableName.Row1.instanceManager.addInstance(1); but still a row is not added when I click a button.

Regard

Ace

Avatar

Level 10

Hi,

Check that the form is saved as a 'Dynamic XML Form'. The addInstance will not work with static forms.

Niall

Avatar

Level 3

I just checked, Yes it is Saved As:Adobe Dynamic XML Form.

And when I type a dot(.) after instanceManager I dont get addInstance under the dropdown.

What am I doing wrong?

Avatar

Level 10

What I suspect is that the reference to the row is not complete.

You have 'TableName.Row1', but of the button is in a different subform to the table, then it should have the name of the table subform as well (say 'myTableSubform').

myTableSubform.TableName.Row1.instanceManager.addInstance(); 

Niall

Avatar

Level 3

The table and the button are noth in the same subform, but I just tried what you suggested, that is. MyTableSubform.TableName.Row1.instannceManager.addInstance(1) but still no luck.

I must also inform you that my table has two rows when it starts, so I want to add the 3rd, 4th, and so on rows.

I've also tried changing .Row1 to .Row2, that didnt help.

Avatar

Correct answer by
Level 10

Hi,

Can you share or email the form? I have sent a pm.

Niall