## 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(.) .$to_R()$name
return(a)
},
name="itemlist")
item$make_ui(container=gwindow("itemList test"))
Run the code above in your browser using DataLab