是否有可能在shinyTree中只有最低级别的子级有一个复选框?在下面的截图中,我希望‘休闲-Fishing’和'Boat‘没有一个复选框,但是其他所有的孩子都有一个复选框(在屏幕截图中;圆形= checkboz,+= no复选框)?
谢谢!
library(shiny)
library(shinyTree)
# Create tree data ----
tree.data <- list(
'Recreational - Fishing' = structure(list(
'Boat' = structure(list(
'Cray pot'= structure("",sttype="default",sticon="glyphicon glyphicon-record"),
'Hand/rod & line' = structure("",sttype="default",sticon="glyphicon glyphicon-record"),
'Cray loop' = structure("",sttype="default",sticon="glyphicon glyphicon-record"),
'Drop net' = structure("",sttype="default",sticon="glyphicon glyphicon-record"),
'Spear' = structure("",sttype="default",sticon="glyphicon glyphicon-record"),
'Other' = structure("",sttype="default",sticon="glyphicon glyphicon-record")),
sttype="default",stopened=FALSE,sticon="glyphicon glyphicon-plus", stdisabled=TRUE)),
sttype="default",stopened=FALSE,sticon="glyphicon glyphicon-plus")
)
# UI ----
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
shinyTree("tree", checkbox = TRUE, search=TRUE, searchtime = 1000)
),
# Show a plot of the generated distribution
mainPanel(
)
)
)
#Server ----
server <- function(input, output) {
# Render Tree
output$tree <- renderTree({
tree.data
})
}
# Run the application
shinyApp(ui = ui, server = server)

发布于 2021-12-08 08:15:10
添加到css中:
.jstree li.jstree-open > a.jstree-anchor > i.jstree-checkbox,
.jstree li.jstree-closed > a.jstree-anchor > i.jstree-checkbox {
display:none;
}发布于 2021-11-24 08:12:02
您可以将以下css添加到您闪亮的应用程序中,以隐藏shinyTree中的一些复选框:
#\31 _anchor > .jstree-checkbox {
display: none;
}
#\32 _anchor > .jstree-checkbox {
display: none;
}

发布于 2022-02-15 03:10:12
在我的例子中,我只想在顶层禁用复选框,所以我的ui看起来如下:
ui <- fluidPage(
tags$head(
tags$style(
HTML("
div.jstree > ul.jstree-children > li > a.jstree-anchor > i.jstree-checkbox {
display:none;
}")
)
),
.
.
.https://stackoverflow.com/questions/70092100
复制相似问题