View source: R/rk.XML.switch.R
rk.XML.switch | R Documentation |
This node can only be used in <logic>
sections. If the provided property
is logical, in the cases
list you must also provide lists called true
and false
. If not, you must provide at least one list called case
.
rk.XML.switch(condition, cases, modifier = NULL, id.name = "auto")
condition |
Either a character string (the |
cases |
A named list of named lists. The lists contained must either be called
|
modifier |
Character string,
an optional modifier to be appended to |
id.name |
Character string, a unique ID for this property.
If |
The values to be returned can be either fixed_value
or dynamic_value
.
A fixed_value
must be a character string which will be returned if the condition
is met. Whereas a dynamic_value
is the id
of another property, an can
be provided as either a character string or an object of class XiMpLe.node
.
An object of class XiMpLe.node
.
The <switch>
node was introduced with RKWard 0.6.1, please set the dependencies
of your component/plugin accordingly.
rk.XML.connect
,
rk.XML.convert
,
rk.XML.external
,
rk.XML.logic
,
rk.XML.set
,
and the Introduction to Writing Plugins for RKWard
# example for a boolean switch myCheckbox <- rk.XML.cbox("foo") rk.XML.switch(myCheckbox, cases=list( true=list(fixed_value="foo"), false=list(fixed_value="bar")) ) # example for a case switch MyRadio <- rk.XML.radio("Chose one", options=list( "First Option"=c(val="val1"), "Second Option"=c(val="val2", chk=TRUE)) ) rk.XML.switch(MyRadio, modifier="string", cases=list( case=list(standard="val1", fixed_value="foo"), case=list(standard="val2", fixed_value="bar")) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.