The switch widget shows two states (e.g. ON and OFF) and can toggle between them.
- Since:
-
- 0.8.0 (2012)
- Source:
Example
Configuration example of a switch widget using mapping and styling


...
<meta>
<mappings>
<mapping name="OnOff">
<entry value="0">O</entry>
<entry value="1">I</entry>
</mapping>
</mappings>
<stylings>
<styling name="GreyGreen">
<entry value="0">grey</entry>
<entry value="1">green</entry>
</styling>
</stylings>
</meta>
...
<switch mapping="OnOff" styling="GreyGreen">
<layout colspan="3"/>
<label>Switch</label>
<address transform="DPT:1.001" mode="readwrite">0/0/0</address>
</switch>
Requires
Methods
-
<inner> action(path, actor, isCanceled)
-
Action performed when the switch got clicked
Parameters:
Name Type Description pathString Internal path of the widget
actorElement DOMElement
isCanceledBoolean If true the action does nothing
- Source:
-
<inner> create(element, path, flavour, type)
-
Creates the widget HTML code
Parameters:
Name Type Description elementElement DOM-Element
pathString internal path of the widget
flavourString Flavour of the widget
typeString Page type (2d, 3d, ...)
- Source:
Returns:
HTML code
- Type
- String
-
<inner> update(address, value)
-
Handles updates of incoming data for this widget
Parameters:
Name Type Description addressString Source address of the incoming data
valueString Incoming data
- Source: