Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Does anybody know how I can type a number of rows in a box and have the table rows grow to that number? Right now I only have 11 rows but I might need up to 40. I will need the signatures to move to the end of the table. thank you

Avatar

Level 1

Expanding_Table.JPG

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi,

Provided your form is "dynamic" you can achieve by using:  .setInstances

What i would recommend is having a single Row in your table and maybe change the name to something like "DataRow." That being said, based on your screen-shot, the structure would be:

Table1

HeaderRow

DataRow

FooterRow

For the DataRow, click the "Binding" tab and check the box "Repeat Row for Each Data Item". Check the "Min Count" box and set to whatever number of rows you always want to be visible (i.e. 11).

Next, you'll need a numeric field (or pre-populated drop-down) that will allow the user to specify the number of desired rows (i.e. Data Items). If you use a numeric field the user will key in the desired number, or if you decide to use a drop-down it should be populated with 1-40 as s selectable values.

On the Exit event of the field, use code:

Table1._DataRow.setInstances(this.rawValue);

NOTE: You might need to modify the name/path above based on your form structure, but this assumes you are going straight to Table1 and targeting the DataRow. Also note the "_" placed in front of DataRow as its required shorthand for instanceManager.

The code above will "set" or create the number instances of DataRow as defined by the value of the field (this.rawValue).

Again, your form must be saved as dynamic and "Repeat Row for Each Data Item" must be selected in order for this to work.

Hope this helps.

View solution in original post

2 Replies

Avatar

Correct answer by
Level 6

Hi,

Provided your form is "dynamic" you can achieve by using:  .setInstances

What i would recommend is having a single Row in your table and maybe change the name to something like "DataRow." That being said, based on your screen-shot, the structure would be:

Table1

HeaderRow

DataRow

FooterRow

For the DataRow, click the "Binding" tab and check the box "Repeat Row for Each Data Item". Check the "Min Count" box and set to whatever number of rows you always want to be visible (i.e. 11).

Next, you'll need a numeric field (or pre-populated drop-down) that will allow the user to specify the number of desired rows (i.e. Data Items). If you use a numeric field the user will key in the desired number, or if you decide to use a drop-down it should be populated with 1-40 as s selectable values.

On the Exit event of the field, use code:

Table1._DataRow.setInstances(this.rawValue);

NOTE: You might need to modify the name/path above based on your form structure, but this assumes you are going straight to Table1 and targeting the DataRow. Also note the "_" placed in front of DataRow as its required shorthand for instanceManager.

The code above will "set" or create the number instances of DataRow as defined by the value of the field (this.rawValue).

Again, your form must be saved as dynamic and "Repeat Row for Each Data Item" must be selected in order for this to work.

Hope this helps.

Avatar

Level 1

Yes this worked!!!! Thank you very much.  Your explanation was easy to follow and it worked!!!

I hope you can help me with one more feature on the same form.

I have a drop down menu on the form on the upper right corner "TYPE OF GRANT" (that consists only of two options "New" and "Continuation" that sets an action for the first column of the template.

When I select "New" from the 'TYPE OF GRANT" dropdown options, I want the fields in the first column to become active.  Right now when I select "New" the header of the column--APPLICATION NUMBER-- shows up but the fields are inactive (the fields should be text fields). (see image below)

New.JPG

When I select "Continuation" everything including the header of the column should be inactive, which seems to work.

(see image below first column)

Continuation.JPG

If you can help me it will be great.  Again thank you so much for all your help.