inst/examples/checkWithText/global.R

library(jsTreeR)
library(shiny)

# small function to shorten the Shiny values
Text <- function(value) {
  lapply(value, `[[`, "text")
}

# CSS for the second tree (the one with `checkWithText=FALSE`)
css <- "
#tree2 .jstree-clicked:not(.jstree-checked) {
  background-color: tomato !important;
}"

# nodes list for both trees
nodes <- list(
  list(
    text = "RootA",
    children = list(
      list(
        text = "ChildA1"
      ),
      list(
        text = "ChildA2"
      )
    )
  ),
  list(
    text = "RootB",
    children = list(
      list(
        text = "ChildB1"
      ),
      list(
        text = "ChildB2"
      )
    )
  )
)

Try the jsTreeR package in your browser

Any scripts or data that you put into this service are public.

jsTreeR documentation built on July 4, 2024, 9:08 a.m.