【发布时间】:2021-08-23 06:21:49
【问题描述】:
我试图保持给定标签的颜色(例如“蓝色”= 蓝色;“绿色”= 绿色),无论它所在的 bucekt_list 是什么。但是,我只能修改给定 bucket_list 的 CSS,而不是单独的标签本身。因此,标签在当前拖入不同的bucket_list 时不会保持各自的颜色。
library(shiny)
library(sortable)
ui <- fluidPage(
tags$style( HTML(".green-sortable .rank-list-item {
background-color: #53C1BE;
}"),
HTML(".blue-sortable .rank-list-item {
background-color: #4080C9;
}")),
fluidRow(column(6, uiOutput("example1")),
column(6, uiOutput("example2")))
)
server <- function(input, output, session) {
output$example1 <- renderUI({
bucket_list(
header = NULL,
group_name = "colours",
orientation = "horizontal",
class = c("default-sortable", "green-sortable"),
add_rank_list(
text = " ",
input_id = "green",
labels = "Green"
))
})
output$example2 <- renderUI({
bucket_list(
header = NULL,
group_name = "colours",
orientation = "horizontal",
class = c("default-sortable", "blue-sortable"),
add_rank_list(
text = " ",
input_id = "blue",
labels = "Blue"
))
})
}
shinyApp(ui, server)
如何修改它以使蓝色和绿色标签分别保持蓝色和绿色,而不管它们被拖到哪个bucket_list?
【问题讨论】:
标签: css r shiny jquery-ui-sortable