rk.XML.optionset: Create XML node "optionset" for RKWard plugins

View source: R/rk.XML.optionset.R

rk.XML.optionsetR Documentation

Create XML node "optionset" for RKWard plugins

Description

Note that if you want to refer to the optioncolumns in your JavaScript code, the id you need is a combination of <optionset id>.<optioncolumn id>.<modifier>. that is, you must always prefix it with the sets' id. For JavaScript code generating with rkwarddev, the easiest way to get to results is to use rk.JS.optionset. It will automatically place your code fragments into a for loop and iterate through all available rows of the set.

Usage

rk.XML.optionset(
  content,
  optioncolumn,
  min_rows = 0,
  min_rows_if_any = 0,
  max_rows = 0,
  keycolumn = NULL,
  logic = NULL,
  optiondisplay = TRUE,
  id.name = "auto"
)

Arguments

content

A list of XiMpLe.nodes to be placed inside the <content> node of this <optionset>.

optioncolumn

A list of <optioncolumn> XiMpLe.nodes.

min_rows

Numeric (integer), if specified, the set will be marked invalid, unless it has at least this number of rows. Ignored if set to 0.

min_rows_if_any

Numeric (integer), like min_rows, but will only be tested, if there is at least one row. Ignored if set to 0.

max_rows

Numeric (integer), if specified, the set will be marked invalid, unless it has at most this number of rows. Ignored if set to 0.

keycolumn

Character

logic

A valid <logic> node.

optiondisplay

Logical value, can be used to automatically add an <optiondisplay> node on top of the <content> section. Depending on whether it's TRUE or FALSE, its index argument will be set to "true" or "false", respectively. Set to NULL to deactivate.

id.name

Character string, a unique ID for this plugin element. If "auto", an ID will be generated automatically from the <content> nodes.

Details

If this isn't flexible enough for your needs, you can also use the ID that functions like id return, because the JavaScript variable name will only contain a constant prefix ("ocol") and the column ID.

Value

An object of class XiMpLe.node.

Note

The <optionset> node was introduced with RKWard 0.6.1, please set the dependencies of your component/plugin accordingly.

See Also

rk.XML.optioncolumn, rk.XML.optiondisplay, rk.JS.optionset, and the Introduction to Writing Plugins for RKWard

Examples

firstname <- rk.XML.input("Given name(s)")
lastname <- rk.XML.input("Family name")
genderselect <- rk.XML.radio("Gender", options=list(
  Male = c(val="m"),
  Female = c(val="f")))
(myOptionset <- rk.XML.optionset(
  content = list(
    rk.XML.row(
      firstname,
      lastname,
      genderselect)),
  optioncolumn = list(
    rk.XML.optioncolumn(firstname, modifier="text"),
    rk.XML.optioncolumn(lastname, modifier="text"),
    rk.XML.optioncolumn(genderselect)
  )
))

rkward-community/rkwarddev documentation built on May 9, 2022, 3:02 p.m.