Consider I have an input field to enter a number of children. When the user enters 2, the data grid component containing child details should display 2 rows without clicking the "Add another" button. If the user enters 3, then 3 rows should be displayed.
Initially, when rendering, the form looks like this,
rendered form
when the user enters the count as 3 to the text field, then the data grid should display with 3 rows,
expected output
There are a number of ways to do this, here's one based on the component's
addRow()
andremoveRow(index)
functions:Run a function that reconciles the number of rows based on the value of another component. In the component's Calculated Value field, you could add something like
or tie the above to an event triggered by a button. Here's a JSFiddle of a simple working example.