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.

In pins 5
  • items array required

    The list to render, e.g. the documents of a storage search.

  • row template value

    The template of one row; the item's fields are its variables.

  • key field value

    The item field that identifies a row (default _meta.guid, then id).

  • empty template value

    Rendered instead when there are no items.

  • data object

    Variables every row can read too.

Out pins 4
  • 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.

Studio canvas example for the web for each block: a table of search results.

Used in these guides

These documentation pages use or explain this block:

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