shinyTree: Create a Shiny Tree

View source: R/shiny-tree.R

shinyTreeR Documentation

Create a Shiny Tree

Description

This creates a spot in your Shiny UI for a shinyTree which can then be filled in using renderTree.

Usage

shinyTree(
  outputId,
  checkbox = FALSE,
  search = FALSE,
  searchtime = 250,
  searchplaceholder = "",
  dragAndDrop = FALSE,
  types = NULL,
  theme = "default",
  themeIcons = TRUE,
  themeDots = TRUE,
  sort = FALSE,
  unique = FALSE,
  wholerow = FALSE,
  stripes = FALSE,
  multiple = TRUE,
  animation = 200,
  contextmenu = FALSE,
  three_state = TRUE,
  whole_node = TRUE,
  tie_selection = TRUE
)

Arguments

outputId

The ID associated with this element

checkbox

If TRUE, will enable checkboxes next to each node to make the selection of multiple nodes in the tree easier.

search

If TRUE, will enable search functionality in the tree by adding a search box above the produced tree. Alternatively, you can set the parameter to the ID of the text input you wish to use as the search field.

searchtime

Determines the reaction time of the search algorithm. Default is 250ms.

searchplaceholder

Add a placeholder value to the search box

dragAndDrop

If TRUE, will allow the user to rearrange the nodes in the tree.

types

enables jstree types functionality when sent proper json (please see the types example)

theme

jsTree theme, one of default, default-dark, or proton.

themeIcons

If TRUE, will show theme icons for each item.

themeDots

If TRUE, will include level dots.

sort

If TRUE, will sort the nodes in alphabetical/numerical order.

unique

If TRUE, will ensure that no node name exists more than once.

wholerow

If TRUE, will highlight the whole selected row.

stripes

If TRUE, the tree background is striped.

multiple

If TRUE, multiple nodes can be selected.

animation

The open / close animation duration in milliseconds. Set this to FALSE to disable the animation (default is 200).

contextmenu

If TRUE, will enable a contextmenu to create/rename/delete/cut/copy/paste nodes.

three_state

If TRUE, a boolean indicating if checkboxes should cascade down and have an undetermined state

whole_node

If TRUE,a boolean indicating if clicking anywhere on the node should act as clicking on the checkbox

tie_selection

If TRUE, controls if checkbox are bound to the general tree selection or to an internal array maintained by the checkbox plugin.

Details

A shinyTree is an output *and* an input element in the same time. While you can fill it via renderTree you can access its content via input$tree (for example after the user rearranged some nodes). By default, input$tree will return a list similiar to the one you use to fill the tree. This behaviour is controlled by getOption("shinyTree.defaultParser"). It defaults to "list", but can be set to "tree", in which case a data.tree is returned.

See Also

renderTree


trestletech/shinyTree documentation built on Sept. 27, 2024, 4:38 a.m.