我正在使用 shinyTree 包及其复选框选项。
library(shiny)
library(shinyTree)
server <- shinyServer(function(input, output, session) {
# Defining lists inside list and rendering it in the shinyTree
output$tree <- renderTree({
list(
root1 = "123",
root2 = list(
SubListA = list(leaf1 = "", leaf2 = "", leaf3=""),
SubListB = structure(list(leafA = "", leafB = ""),stselected=TRUE)
)
)
})
})
ui <- shinyUI(
pageWithSidebar(
# Application title
headerPanel("shinyTree with checkbox controls"),
sidebarPanel(
mainPanel(
# Show a simple table with checkbox.
shinyTree("tree", checkbox = TRUE)
))
)
shinyApp(ui, server)
在运行上面的代码时,在选择 sublistB 时,它的子项也会被选中。
我怎样才能只选择 subListB,而不选择它的叶子。