ch_list_add: Add an item to a list

Description Usage Arguments Details Value

View source: R/ch_list_add.R

Description

Creates a list of shiny objects to encapsulate the operation of adding an item to a list.

Usage

1
ch_list_add(id, item = "item", plural = NULL)

Arguments

id

character, tag to prepend to the input and output id's

item

character, for the ui, what to call the item being added - default is "item"

plural

character, for the ui, what to call the plural of the item being added - default is paste0(item, "s")

Details

The list of shiny objects will contain:

ui_controller

shiny::taglist of ui elements for the controller

ui_view

shing::taglist of ui elements for the view

server_model

function with reactive code

The list returned by this function has to be available to both the ui and the server. If not using the shinyApp formulation, perhaps global.R could be useful.

The list ui_controller will have members:

name

shiny::textInput used to specify the name of the item to be added to the list

add

shiny::actionButton used to invoke the action of adding the item to the list

The list ui_view will have members:

status

shiny::verbatimTextOutput showing if it is possible to add to the list

The function server_model() will be called from your server function. Its arguments are:

input, output, session

input, output, session values passed from your server function

rctval_source, item_source

shiny::reactiveValues object, character string

rctval_source[[item_source]] an object of some sort to be added to the list.

rctval_list, item_list

shiny::reactiveValues object, character string

The default value for rctval_list is rctval_source. rctval_list[[item_list]] is expected to be a list, to which the object will be added

Value

list containing ui_controller, ui_view, and server_model


ijlyttle/shinychord documentation built on May 18, 2019, 3:41 a.m.