Browse the docs

Update a panel

Changes a view in a panel that is showing: a number, some text, a table's rows, a chart's points.

Update panel id

Details #

Finds the panel by its id and sets views in it by their id. Each entry of set is either a plain value or an object of properties to change.

A plain value replaces the view's main value: a text's text, a field, toggle, slider, picker or progress value, a table's rows, a chart's data, a button's title, an image's symbol. An object changes the properties you name and leaves the rest: {"status": {"text": "Almost there", "style": "caption"}}. A view's type, id and children cannot be changed, and neither can a field's kind or a button's run.

The change is checked against the same vocabulary and limits as the panel itself before anything moves; a bad update changes nothing, fails the step with where the problem is, and shows it in red under the panel's title. Changes land on the next frame (about 16 ms), and several changes to one view inside a frame draw once, so a loop can update a bar as fast as it likes. They animate with the system's quick spring, or cross-fade when Reduce Motion is on.

A field the person is typing in keeps what they typed: its new value is dropped unless force is on. Replacing a table's rows clears the chosen row.

If no panel has that id, the step fails with "no panel called 'dl' is showing; it may have been closed".

Parameters #

ParameterTypeRequiredValuesWhat it does
idtextYesThe panel's id.
setrecordYesViews by id: {"bar": 0.4, "status": "Downloading 40%"}.
forceyes / noReplace the text of a field even while it has the keyboard.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Move a bar and a line of text
Do
  1. Show panel “Working” and carry on
  2. Update panel “job” (2 things)
  3. Wait 1 s
  4. Close panel “job”
Open in Switchboard to try it

Gotchas #

  • Update a table by giving rows again: {"results": [{"name": "…"}]}.

  • A text value that is only {{ }} keeps its type, so "bar": "{{ i / 20 }}" sets a number.

See also #

Show a panel, Read a panel, Close a panel