Iterator feature overview
Updated at:
An iterator is a list generator. In the block editor, you can create a unit template by adding and grouping one or more widgets. The iterator then uses data to generate a list. The number of list items is determined by the length of the array in the iterator's data. This topic describes the features and operations of the iterator.
An iterator is a list generator. Each item in the list is called an iteration unit. The widget types and layout in the unit are the same as the unit template. The data for the widgets in the unit can be driven by their own data source or obtained from the iterator.
Important The immediate child layer of an iterator can only be an iteration unit, not a regular widget. Regular widgets are contained within the iteration unit.
Iterator operations
| Operation | Description |
| Generate an iterator |
|
| Add a widget to an iterator | In the layer panel of the block editor, select a widget that is not inside an iterator. Drag the widget's layer into the iterator. |
| Remove a widget from an iterator | In the layer panel of the block editor, select a widget that is inside an iterator. Drag the widget's layer to a position outside the iterator. |
| Get data from an iterator | The data response for an iterator must be a complex array. Each item in the array can be passed to child widgets. A widget inside an iterator retrieves its data item from the nearest parent iterator. The data then passes through the widget's filter to produce the final response. To retrieve data from an iterator for a widget:
|
| Rename an iterator | In the layer panel of the block editor, double-click the iterator to rename it. |
Is this page helpful?