website logo
👥 Community🎯 Samples on GitHub🚦System Status
💡 Guides
🚀 Examples
🍕 Developer Reference
⚡️ Changelog
🎥 Video Library
Navigate through spaces
⌘K
Examples Overview
Setting up your solution
Jig Types
Components
Datasource
Actions
Preview
Widgets
Expressions
Aggregation
Boolean
Comparison Operators
Date & Time
Path Operators
Functional Programming
Jigx Variables
Predicate Queries
String
Docs powered by
Archbee
Actions

set-state

5min

The set-state action is used to set the state of the key inside the jig file, which can further be used to work with certain UI components. This action can also be used to set the state of the UI components.

Configuration options

A set-state action can be set up in various ways:

  1. As onFocus action that will be executed
  2. As onRefresh action that will be executed
  3. As the main action on the jig, and when you press the action set-state action will be executed
  4. As onPress and onChange action that will be executed when you trigger onPress or onChange event

Examples and code snippets 

set-state as onFocus/onRefresh

Count triggers with set-sate
Count triggers with set-sate


Set state action is used when the onFocus/onRefresh event is triggered and a count is shown of the number of triggers.

See the example in GitHub.

onFocus.jigx
onRefresh.jigx
|
onRefresh: 
  type: action.set-state
  options:
    state: =@ctx.solution.state.onRefresh-key
    value: =@ctx.solution.state.on-refresh-key +1


set-state as action

Set-state action
Set-state action


Set-state action is used as the primary action on the , to set the value of the action-key to +1.

See the example in GitHub.

action.jigx
|
actions:
  - children:
      - type: action.set-state
        options:
          title: Add 1 to your action-key
          state: =@ctx.solution.state.action-key
          value: =@ctx.solution.state.action-key +1


set-state as onPress/onChange

Set-state onPress/onChange
Set-state onPress/onChange


Set-state action used on the list as onPress/onChange action, to set the value of the key to +1.

See the example in GitHub.

onPress.jigx
onChange.jigx
|
onPress: 
  type: action.set-state
  options:
    state: =@ctx.solution.state.onPress-key
    value: =@ctx.solution.state.on-press-key +1


See also

  • Developer reference
  • Related examples (GitHub)



Updated 22 Sep 2023
Did this page help you?
PREVIOUS
reset-state
NEXT
submit-form
Docs powered by
Archbee
TABLE OF CONTENTS
Configuration options
Examples and code snippets
set-state as onFocus/onRefresh
set-state as action
set-state as onPress/onChange
See also
Docs powered by
Archbee
Copyright © 2023 Jigx, Inc. All rights reserved. Terms of Service