update Action

An action to update components in the UI.

{
  "update": {
    "ids": {
      "someID": {
        "text": "New text for the component",
        "colour": "systemRedColor"
      }
    }
  }
}

Properties

relayout
BOOL
Default: false

Mark the layout as needing to be re-laid out, triggering the layout manager to recacluate.

Note

Only set to true if you expect an update to change the sizing metrics of the components you are updating.

ids
OBJECT

A map of component ids to the JSON used for updating that component

Note

On successful update of components, the entire UI will only be marked for re-layout if the relayout flag is set to true.

Examples

Change properties of a label

{
  "type": "view",
  "layout": "inline",
  "direction": "vertical",
  "components": [
    {
      "id": "exampleLabel",
      "type": "label",
      "text": "I am a text label to serve as the target"
    },
    {
      "type": "button",
      "text": "Modify the label",
      "events": [
        {
          "triggers": "actioned",
          "action": {
            "type": "json",
            "src": {
              "update": {
                "ids": {
                  "exampleLabel": {
                    "text": "My text and colour were changed",
                    "colour": "systemRedColor"
                  }
                }
              }
            }
          }
        }
      ]
    }
  ]
}