Enabled/Visible Configuration
Most element types support the enabled and the visible attributes. In these attributes, specify JavaScript clauses that evaluate to true or false. You can use the $ui prefix to access UI components by their id or action name, then perform your checks against them.
For example, this enables the DEVICE_PHASES CheckBox when the EVENT_TYPE is set to RESTORED:
DEVICE_PHASES: {
enabled: '$ui.EVENT_TYPE.currentValue == "RESTORED"',
field: 'data.event.phases',
type: 'checkbox-group',
options: 'data.event.phaseOptions'
}
This enables the POSITION action when the EVENTS_TABLE has a single selection and when the selected row has a device alias:
POSITION: {
enabled: '$ui.EVENTS_TABLE.hasSingleSelection && $ui.EVENTS_TABLE.row.device_alias',
actionFunction: 'onPositionSelectedEvent'
},
This enables the MAKE_RADIAL action when the table has any number of selections, and they all have the radial flag set to false:
MAKE_RADIAL: {
enabled: '$ui.EVENTS_TABLE.hasSelection && $ui.EVENTS_TABLE.allMatch("!$row.radial")',
actionFunction: 'onMakeRadialSelectedEvent'
},
Tables support the following:
hasSelection: true/false
hasSingleSelection: true/false
row: row data for the single selection
allMatch(): function that allows you to test if all of the selected rows match the provided expression. The row values can be referenced using the keyword "$row"
noneMatch(): function that allows you to test if none of the selected rows match the provided expression. The row values can be referenced using the keyword "$row"
anyMatch(): : function that allows you to test if any of the selected rows match the provided expression. The row values can be referenced using the keyword "$row"
Other UI components support:
hasValue: true/false
currentValue: the object in that component selected (for Tabs): the key of the selected tab
Other Uses for Expressions
In addition to the common uses of custom columns in tables and specifying enabled/visible logic, expressions are also used in a number of other places in the code to implement configurable conditional logic, for example, the turnOnRecordingExpression and sheetLockingExpression define some logic that is used to determine what to do when switching sheets are opened.