Working with Repeaters
Workshop Summary: Working with Repeaters
The workshop covered using the repeater in Data² and how it can be used to create dynamic, interactive interfaces. Repeaters are a block property that lets you visually represent data that repeats on a screen. They're used when you have elements without a fixed count on screen that need to be created dynamically based on a data source.
Repeaters can be used to create lists, columns, or grids of elements. They're bound to a dataset, and each repeated block has access to that dataset's properties through a context reference. The repeater also has a repeatKey property, which allows the repeated children to update when the data changes.
During the workshop, it was shown how to use the repeater's index to control the position and rotation of elements. The use of DataGridBlock to display a dataset's records was also mentioned. Additionally, it was explained how to repeat other types of data besides datasets, such as numbers.
To customize the appearance of elements, it was taught how to use states and controls. The repeater can have an on/off state, controllable via a click. Each copy of the repeater has its own individual state, unless the state is defined outside the repeater — in which case all repeaters stay in sync with the external state.
It was also shown how to bind controls to datasets, allowing multiple records to be edited simultaneously. It was explained how to create a delete button, which uses the select-and-delete-records action. However, to avoid losing unsaved changes when deleting a record, it was necessary to sync before performing the deletion.
Overall, the workshop explored ways to create interesting, engaging visual experiences using the repeater in Data². Participants learned to create dynamic, interactive layouts, using the repeater's features to connect to datasets, control states, and customize the appearance of elements.