Skip to content

Commit

Permalink
Shiny example checkWithText
Browse files Browse the repository at this point in the history
  • Loading branch information
stla committed Oct 24, 2023
1 parent 75784cd commit fcfee22
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
27 changes: 27 additions & 0 deletions inst/examples/checkWithText/global.R
Original file line number Diff line number Diff line change
@@ -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"
)
)
)
)
13 changes: 13 additions & 0 deletions inst/examples/checkWithText/server.R
Original file line number Diff line number Diff line change
@@ -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)
})

}
)
19 changes: 19 additions & 0 deletions inst/examples/checkWithText/ui.R
Original file line number Diff line number Diff line change
@@ -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")
)
)
)

0 comments on commit fcfee22

Please sign in to comment.