docs
/
Studio Manager

Effects and formats

What runs after an action, and how bound values are rendered.

Two small vocabularies do a lot of work: effects decide what happens after an action, formats decide how a bound value renders.

Effects

An effect chain runs after an action resolves. data-on-success runs on success, data-on-error on failure.

Chains are pipe-separated and run left to right:

data-on-success="notify:Saved | reset-form | refresh:#my-list"

Each entry is verb or verb:argument.

EffectSyntaxWhat it does
navigatenavigate:<url>Go to a URL
notifynotify:<message>Show an info toast
notify-errornotify-error:<message>Show an error toast
close-dialogclose-dialogRemove the open attribute from the nearest open dialog or drawer — see the warning below
open-dialogopen-dialog:#dialogIdSet the open attribute on the element the selector matches — see the warning below
reloadreloadHard reload the page
refreshrefresh:#idRe-run that element's data-source (or data-loop)
set-stateset-state:path=valueWrite into appmint.state
reset-formreset-formReset the form the action came from
focusfocus:#selFocus an element

refresh:#id is usually what you want after a write — it re-runs that source so the list reflects the change without a page reload. Always give it the target: a bare refresh sends its signal to the window, which no source listens on, so nothing re-runs.

open-dialog and close-dialog do not open or close a wm-dialog or wm-drawer. They only set or remove its open attribute, and those elements read open once, when they start. Open and close them with the ui.dialog / ui.drawer action, as in Custom elements.

Worked example

<form data-action="ticket.create"
      data-payload="form"
      data-on-success="notify:Ticket opened | reset-form | refresh:#my-tickets"
      data-on-error="notify-error:Could not open ticket">
  <input name="subject" required>
  <textarea name="body"></textarea>
  <button type="submit">Open ticket</button>
</form>

Submitting serializes the form, creates the ticket, toasts, clears the form, and refreshes only the ticket list.

Formats

data-format renders a bound value for display. The underlying value is untouched.

FormatRenders as
currencyCurrency — takes a currency option, ISO code, default USD
numberLocale-formatted number
percentPercentage
dateLocale date
datetimeLocale date and time
parenthesesWraps positive numbers in parentheses
uppercaseUPPERCASE
lowercaselowercase
capitalizeCapitalized

Format options

Options are passed as separate attributes, named data-format-opt-<option>:

<span data-bind="data.price"
      data-format="currency"
      data-format-opt-currency="EUR"></span>

Only currency takes an option today — the ISO currency code.