web for each
This block is part of the web group and was last modified in core v15.0.1.
web for each v15.0.1 Repeats a row template for every item of a list, e.g. the rows of a table. Every row is keyed, so a web action can later replace or remove exactly that row.
- items
arrayrequiredThe list to render, e.g. the documents of a storage search.
- row template
valueThe template of one row; the item's fields are its variables.
- key field
valueThe item field that identifies a row (default _meta.guid, then id).
- empty template
valueRendered instead when there are no items.
- data
objectVariables every row can read too.
- html
value - count
number - success
condition - error
value
Data block (no flow pins): renders `template` (or the block's stored `html` field) once per element of `items`, in order, and outputs the rows joined as html, plus count. A row's context is the item (its fields by name), with the `data` object, the custom pins and `web` visible behind it, and {{@index}} {{@number}} {{@first}} {{@last}}. Each row's first element gets data-key=<key>: the item field named by `key` (a dotted path), else _meta.guid, guid, id or key, else the row's index; a row whose root already has data-key keeps its own. Empty or non-list items: renders `empty` (a template, with the shared data) or "", count 0. Put the html into the page with {{{rows}}} (triple braces: it is already escaped markup). Error: html="", success=false, error set.
datatable |
table rows |
list |
repeat |
loop template |
search runs in the page's flow and its array feeds web for each, which renders the row template once per document and gives every row a data-key, so a later action can replace or remove exactly that row. It has no flow pins: it runs when something reads its html. Here that is a custom pin of web render, printed in the page template with triple braces, {{{rows}}}, and count goes to a second one. The empty pin is the template for a list with no items.
Used in these guides
These documentation pages use or explain this block:
- Building a Dashboard with Charts
- Building with AI
- Common Blueprint Patterns
- Escaping and Security
- Layouts and Partials
- Lists and Tables
- Markup Reference
- Migrating from State Pages
Version history
Introduced in v15.0.1.
v15.0.1: block added in this release.
Back to
web Return to the main group to view all sub-groups Back to web templates Return to the group to view all blocks within this group 