You are viewing limited content. For full access, please sign in.

Question

Question

Show Multiple Rows in Table

asked on March 14, 2014

I have a form that includes several tables with the ability to repeat rows. Is it possible in that case to default the display of the rows to show 3 rows to start with?

0 0

Answer

APPROVED ANSWER
replied on March 14, 2014 Show version history

With repeatable tables, you cannot change how many rows will appear by default from the Edit page, but you can use JavaScript to achieve the desired effect. On the CSS and JavaScript page, take note of the ID attribute for the table's add button.

 

 

Then you can add some JavaScript to simulate clicks on this button:

$(document).ready(function () {
for (i = 0; i < 2; i++) // to add more rows, set i < a bigger number
{
  $('#q2').trigger('click');
}
});

 

This is a good place to start, but you might want to play with it and add more code to make sure the behavior is what you anticipate (for example, ensuring the script doesn't keep adding rows through various user tasks).

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.