[英]Change the border colour of selectinput from the server side
This is a followup question to this question. 这是该问题的后续问题。 In the previous question the border of
selectInput
was changed from the ui side using the following argument tags$head(tags$style(HTML( "#Select1 ~ .selectize-control.single .selectize-input {border: 1px solid #dd4b39;}")))
. 在上一个问题中,使用以下参数从用户界面更改了
selectInput
的边界: tags$head(tags$style(HTML( "#Select1 ~ .selectize-control.single .selectize-input {border: 1px solid #dd4b39;}")))
。 Now I would like to change the border colour of a particular select output from the server side. 现在,我想更改服务器端特定选择输出的边框颜色。 My main aim is actually to change the colour based of different conditions.
我的主要目的实际上是根据不同的条件更改颜色。 To change the colour from the server side I tried the following code but it does not seem to work.
为了从服务器端更改颜色,我尝试了以下代码,但它似乎不起作用。 Is there a way to achieve this?
有没有办法做到这一点?
Here is the code I tried: 这是我尝试的代码:
library(shiny)
ui <- fluidPage(
tags$head(tags$style(htmlOutput("Border_Arg"))),
selectInput("Select1", "Option1", choices = NULL),
selectInput("Select2", "Option2", choices = NULL)
)
server <- function(input, output){
output$Border_Arg <- renderUI({"#Select1 ~ .selectize-control.single .selectize-input {border: 1px solid #dd4b39;}"})
}
shinyApp(ui = ui, server = server)
You were close. 你近了
Find a running example below: 在下面找到一个正在运行的示例:
library(shiny)
ui <- fluidPage(
selectInput("Select1", "Option1", choices = NULL),
selectInput("Select2", "Option2", choices = NULL),
uiOutput("Border_Arg")
)
server <- function(input, output){
output$Border_Arg <- renderUI({
tags$head(tags$style(HTML( "#Select1 ~ .selectize-control.single .selectize-input {border: 1px solid #dd4b39;}")))
})
}
shinyApp(ui = ui, server = server)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.