jig-state (set & reset)
Use actions to set or reset various jig states. These operations affect screen-specific data, enabling dynamic UI updates and logic control. Proper state management ensures consistent behavior and data updates across the screen.
The set-jig-state action updates a jig’s state value, acting as a variable accessible within the current jig instance.
The reset-jig-state action restores one or more jig states to their initial values.
Refer to state for more information on the various state options and their respective functionality.
Configuration options
A set-jig-state or reset-jig-state actions can be set up in various ways, either by using an event or an action button to trigger the change:
onFocus— executes the action when the screen gains focus.onRefresh— executes the action when the screen is refreshed.As the main action on the jig, and when you press the action, the
set-jig-stateorreset-jig-stateaction will be executed. TheonPressandonChangeevents will be executed when you trigger these events.
Some properties are common to all actions, see Common action properties for the list of actions and their configuration options.
changes
Specify the jig-state's State Key and provide the new state value using an expression, text or datasource.
title
Provide the action button with a title, for example, Submitted.
icon
Select an icon to display when the action is configured as the secondary button or in a header action.
isHidden
false hides the action button, true shows the action button. Default setting is true.
style
isDanger - Styles the action button in red or your brand's designated danger color. isDisabled - Displays the action button as greyed out. isPrimary - Styles the action button in blue or your brand's designated primary color. isSecondary - Sets the action as a secondary button, accessible via the ellipsis. The icon property can be used when the action button is displayed as a secondary button.
How to configure a jig state
At the top of the jig file, configure the states property by defining the state's variable key name and initial values of the jig screen.
Within the jig configure the set-jig-state action either in an event, such as onPress, or in the action property.
Use the reset-jig-state action to reset the jig states to its initialValue.
Examples and code snippets
This example demonstrates an inspection checklist that uses the jig's state to track when the checklist is complete. Two key state variables are used:
checksStarted: Tracks if the inspection has started (starts asfalse)checksCompleted: Tracks if all checks are finished (starts asfalse)
Tapping on the choice-fields sets the jig's checksStarted state to true .
Tapping the Inspection Complete button sets the jig's checksCompleted state to true. This single state change triggers three things automatically:
All checkboxes become disabled (you can't change them anymore)
A success banner appears at the top
The complete button is hidden
To reset the jig states to their initial values, reset actions run when you:
Navigate back to the jig (
onFocus)Pull down to refresh (
onRefresh)
Both actions reset the state variables, so you can start fresh each time.

Last updated
Was this helpful?