treecheckInput: Tree check Input

View source: R/input-treecheck.R

treecheckInputR Documentation

Tree check Input

Description

Tree check Input

Usage

treecheckInput(
  inputId,
  label = NULL,
  choices,
  selected = NULL,
  hierarchical = TRUE,
  levels = 1,
  borders = TRUE,
  ...,
  nodes_input = FALSE,
  return_value = c("name", "id", "all"),
  width = NULL
)

Arguments

inputId

The input slot that will be used to access the value.

label

Display label for the control, or NULL for no label.

choices

A list to be used as choices, can be created with make_tree().

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 : ⁠input$<inputId>_nodes⁠.

return_value

Value returned server-side, default is the element name, other possibilities are "id" (works only if nodes have an id) or "all" to returned all the tree under the element selected.

width

The width of the input, e.g. '400px', or '100%'.

Value

Server-side: A character value or a list depending on the return_value argument.

See Also

updateTreeview() and others functions to manipulate tree server-side.

Examples


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)

dreamRs/shinytreeview documentation built on July 3, 2024, 7:02 a.m.