Skip to content

Commit

Permalink
doc on Shiny values
Browse files Browse the repository at this point in the history
  • Loading branch information
stla committed Oct 24, 2023
1 parent 7409aca commit 75784cd
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ of the checkboxes: it controls whether the checkboxes must be (un)checked when
clicking on the text of a node.

- The Shiny input value `ID_selected_tree` (see `?jstree-shiny`) has been
renamed to `ID_checked_tree`. If you set `checkWithText` to `FALSE`, then
you *must* use this input value to get the selected nodes.
renamed to `ID_checked_tree`, and there are new Shiny values provided when
the checkboxes are enabled. Their description is given in `?jstree-shiny`.


# jsTreeR 2.3.3 (2023-10-10)
Expand Down
24 changes: 15 additions & 9 deletions R/jstree-shiny.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,26 @@
#'
#' @section Shiny values:
#' If the \code{outputId} is called \code{"ID"} for example, you have four
#' or five available Shiny \code{input} values in the server:
#' or seven available Shiny \code{input} values in the server:
#' \code{input[["ID"]]} contains the tree with the node fields \code{text}
#' and \code{data} only, \code{input[["ID_full"]]} contains the full tree,
#' \code{input[["ID_selected"]]} contains the selected nodes,
#' \code{input[["ID_selected_paths"]]} is like \code{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 \code{input}
#' value if you have set \code{checkboxes=TRUE} in the \code{\link{jstree}}
#' command: \code{input[["ID_checked_tree"]]}, which is like
#' \code{input[["ID_selected"]]} except that it preserves the hierarchy, in
#' other words it provides the selected nodes with their parent(s).
#' If you have set \code{checkboxes=TRUE} and \code{checkWithText=FALSE} in
#' the \code{\link{jstree}} command, then \code{input[["ID_checked_tree"]]}
#' is the only way to get the selected nodes.
#' the values of their text field. This makes four Shiny values always
#' present. There are three additional Shiny values if you have set
#' \code{checkboxes=TRUE} in the \code{\link{jstree}} command:
#' \code{input[["ID_checked"]]} contains the checked nodes,
#' \code{input[["ID_checked_paths"]]} provides the paths to the checked
#' nodes. If you have set \code{checkboxes=TRUE} and
#' \code{checkWithText=TRUE} (the default), then these two additional
#' Shiny values are useless because 'checked' is the same as 'selected' in
#' this situation. In fact, the selected nodes strangely behave when
#' \code{checkWithText=FALSE}, they are not usable. Finally, the seventh
#' Shiny value that is provided when \code{checkboxes=TRUE} is
#' \code{input[["ID_checked_tree"]]}. It is like \code{input[["ID_checked"]]}
#' except that it returns the hierarchy, in other words it provides the
#' checked nodes with their parent(s).
#'
#' @name jstree-shiny
#'
Expand Down
24 changes: 15 additions & 9 deletions man/jstree-shiny.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75784cd

Please sign in to comment.