Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

traitr (version 0.13)

itemList: An itemList is used to store a list of similar items or itemgroups with a means to edit individually...

Description

An itemList is used to store a list of similar items or itemgroups with a means to edit individually

Usage

itemList(items=list(), items_name="", item_factory, name, label=name,
    help="", tooltip="", attr=list(), model, editor, ...)

Arguments

items
list of similar items, may be empty list
items_name
Header name on top of table displaying item list
item_factory
function to call to produce a new item, e.g. function(.) numericItem(1)
name
name of itemList object
label
label for itemList object
help
help string
tooltip
tooltip
attr
attributes passed to make_ui constructor
model
optional model to pass in
editor
optional editor to pass in
...
passed along to Item$proto() call

Value

  • A proto object. Call obj$show_help() to view its methods and properties.

Examples

Run this code
## make icons
imagedir <- system.file("images",package="traitr")
addStockIcons(gsub("\\.png","", list.files(path=imagedir)),
list.files(path=imagedir, full.names=TRUE))
## make item
item <- itemList(items=list(),
items_name="Personnel",
item_factory = function(.) {
a <- anItemGroup(items=list(
name=stringItem(""),
rank=choiceItem("Scout", values=c("Scout","Captain","General")),
serial.number = stringItem("", label="Serial number")))
a$post_process <- function(.) {
.$icon <- tolower(.$get_rank())
}
a$to_string <- function(., drop=TRUE) .$to_R()$name
return(a)
},
name="itemlist")

item$make_ui(container=gwindow("itemList test"))

Run the code above in your browser using DataLab