View source: R/input-treecheck.R
treecheckInput | R Documentation |
Tree check Input
treecheckInput(
inputId,
label = NULL,
choices,
selected = NULL,
hierarchical = TRUE,
levels = 1,
borders = TRUE,
...,
nodes_input = FALSE,
return_value = c("name", "id", "all"),
width = NULL
)
inputId |
The |
label |
Display label for the control, or |
choices |
A |
selected |
Default selected value, must correspond to the Id of the node. |
hierarchical |
When a level is selected, also select all levels below it? |
levels |
Sets the number of hierarchical levels deep the tree will be expanded to by default. |
borders |
Show or not borders around items. |
... |
Others parameters passed to JavaScript treeview method. |
nodes_input |
Send nodes data through an input value : |
return_value |
Value returned server-side, default is the element name,
other possibilities are |
width |
The width of the input, e.g. |
Server-side: A character
value or a list
depending on the return_value
argument.
updateTreeview()
and others functions to manipulate tree server-side.
library(shiny)
library(shinytreeview)
data("cities")
ui <- fluidPage(
tags$h3("treeviewInput cities example"),
treecheckInput(
inputId = "tree",
label = "Choose a city:",
choices = make_tree(
cities, c("continent", "country", "city")
)
),
verbatimTextOutput(outputId = "result")
)
server <- function(input, output, session) {
output$result <- renderPrint({
input$tree
})
}
if (interactive())
shinyApp(ui, server)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.