Output and render functions for using jstree
within
Shiny applications and interactive Rmd documents. See examples with
jstreeExample
.
jstreeOutput(outputId, width = "100%", height = "auto")renderJstree(expr, env = parent.frame(), quoted = FALSE)
jstreeOutput
returns an output element that can be included
in a Shiny UI definition, and renderJstree
returns a
shiny.render.function
object that can be included in a Shiny server
definition.
output variable to read from
must be a valid CSS unit (like '100%'
,
'400px'
, 'auto'
) or a number, which will be coerced to a
string and have 'px'
appended
an expression that generates a jstree
the environment in which to evaluate expr
logical, whether expr
is a quoted expression
(with quote()
); this is useful if you want to save an expression
in a variable
If the outputId
is called "ID"
for example, you have four
or five available Shiny input
values in the server:
input[["ID"]]
contains the tree with the node fields text
and data
only, input[["ID_full"]]
contains the full tree,
input[["ID_selected"]]
contains the selected nodes,
input[["ID_selected_paths"]]
is like input[["ID_selected"]]
except that it provides the paths to the selected nodes instead of only
the values of their text field, and you have a fifth Shiny input
value if you have set checkboxes=TRUE
in the jstree
command: input[["ID_selected_tree"]]
, which is like
input[["ID_selected"]]
except that it preserves the hierarchy, in
other words it provides the selected nodes with their parent(s).