Model reference
Reference Figure: Iterating a Collection in a Panel
The panel iterator repeats a panel for every item in a collection. This figure shows the collection source, the current item and the repeated content.
A panel is a reusable block of interface content. A panel iterator connects a panel to a collection and repeats the block once for every item. The panel never holds the whole list. It holds one item at a time, which keeps the template small and easy to read.
Parts of the iterator
- Collection source. A model attribute that holds the list, usually supplied by a controller.
- Item binding. The name used inside the panel for the current item.
- Repeated panel. The content that is rendered for every item.
- Empty state. The content shown when the collection has no items.
Designing the empty state
An empty collection is a normal case, not an error. Write a short empty state that explains what the user can do next, for example a link to create the first record. The generator writes the empty state from the panel settings, so it stays next to the repeated content.
The iterator figure is useful when a repeated block renders the wrong data. Check the item binding first, then the collection name. Most mistakes are a small mismatch between the two names.