diff --git a/inst/examples/checkWithText/global.R b/inst/examples/checkWithText/global.R new file mode 100644 index 0000000..d236759 --- /dev/null +++ b/inst/examples/checkWithText/global.R @@ -0,0 +1,27 @@ +library(jsTreeR) +library(shiny) + +nodes <- list( + list( + text = "RootA", + children = list( + list( + text = "ChildA1" + ), + list( + text = "ChildA2" + ) + ) + ), + list( + text = "RootB", + children = list( + list( + text = "ChildB1" + ), + list( + text = "ChildB2" + ) + ) + ) +) diff --git a/inst/examples/checkWithText/server.R b/inst/examples/checkWithText/server.R new file mode 100644 index 0000000..8de912b --- /dev/null +++ b/inst/examples/checkWithText/server.R @@ -0,0 +1,13 @@ +shinyServer( + function(input, output, session){ + + output[["tree1"]] <- renderJstree({ + jstree(nodes, checkboxes = TRUE) + }) + + output[["tree2"]] <- renderJstree({ + jstree(nodes, checkboxes = TRUE, checkWithText = FALSE) + }) + + } +) diff --git a/inst/examples/checkWithText/ui.R b/inst/examples/checkWithText/ui.R new file mode 100644 index 0000000..e233a71 --- /dev/null +++ b/inst/examples/checkWithText/ui.R @@ -0,0 +1,19 @@ +shinyUI( + fluidPage( + tags$h3("The `checkWithText` option."), + br(), + splitLayout( + tagList( + tags$h4("`checkWithText` is `TRUE` (default)"), + helpText("You can click on a node text to select this node.") + ), + tagList( + tags$h4("`checkWithText` is `FALSE`"), + helpText("Try to click on a node text.") + ) + ), + splitLayout( + jstreeOutput("tree1"), jstreeOutput("tree2") + ) + ) +)