我正在使用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 was selected but the child leafA and leafB also are selected
我怎么能只选择subListB,而不选择它的叶子。
发布于 2017-11-09 15:51:00
我不知道一种直接的方法,但作为B计划,你可以拥有这个节点的一个特定的子节点。您将提供一个表示其父对象的名称,您可以在不选择其他children/leaf的情况下选择该名称。
SubListA = list(leafSLA = "SubListA", leaf1 = "", leaf2 = "", leaf3=""),
SubListB = structure(list(leafSLB = "SubListB", leafA = "", leafB = ""),stselected=TRUE)https://stackoverflow.com/questions/42002790
复制相似问题