Unit Output State Variable Reference

Table of contents


Introduction

A unit output (unitOutput) state variable represents a numeric value with multiple possible units. The app may provide the user a choice of their desired units for the number. The app can also choose which units it wants to compute with independent of the user's choice. Each rendered component will display according to the format and limits specified for the chosen unit in the state variable.

The unit input contains several child numericOutput state variables, one for each unit is supports. Each child state variable is published with a subName corresponding to its unit (e.g., 'myPage_mySv_kg' and 'myPage_mySv_lb'). When one child state variable changes, the others are updated with the new value converted to their respective units.

Each unit input has an associated unitClass string. Each unitClass is associated with a unitSelector state variable. The unitSelector state variable controls which unit each rendered component will be displayed to the user. Many unitInput state variables can have the same unitClass, and, therefore will be controlled by the same unitSelector.

The unitOutput state variable's component instance will display the currently selected unit sibling. If the showUnits attribute or the '{{...@}}' template syntax is used, the component will also display the appropriate unit abbreviations for the currently selected unit.

The app code or a component template may also refer to a specific child numericOutput state variable. Any modification to that child will also update its siblings with converted values.

Constructor

Syntax

ctl.createPage({
	...,
	stateVarInfo:[
		{type:'unitOutput', ...},
	],
})

Parameters


Instance methods

Inherited methods

Note: The component() method returns a NumOutputSvCmp.

Instance properties

Inherited properties

isNumber

Always true for unitOutput.

Value

A Boolean.


isUnit

Always true for unitOutput.

Value

A Boolean.


isUnitParent

Always true for unitOutput.

Value

A Boolean.


unitClass

The unitClass string for the unitSelector that controls which unit sibling is current for this state variable.

Value

A String.


Component attributes

Inherited attributes


DOM element properties