简体   繁体   English

从服务器端更改selectinput的边框颜色

[英]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.

相关问题 更改 Shiny 仪表板的文本颜色选择输入文本 - Change text colour of Shiny Dashbaord selectInput text 根据 Shiny 中的 selectInput 更改 leaflet map 中颜色标记的颜色 - Change colour of colour markers in leaflet map based on selectInput in Shiny Shiny R:更改 selectInput 的边框颜色 - Shiny R: Change border color of selectInput 如何根据 selectInput() 有条件地更改 Shiny wellPanel() 背景颜色? - How to conditionally change Shiny wellPanel() background colour depending on selectInput()? 在 Shiny 应用程序中的 group_by 函数内从服务器端的 selectInput 传递选择 - Pass the choices from selectInput on server side inside group_by function in Shiny app 以交互方式更改 selectInput 选项 - Interactively change the selectInput choices 通过 selectInput 或 actionButton 更改选择 - Change selection by selectInput OR actionButton 将UI中的selectInput值动态传递到R中的服务器代码 - Dynamically passing selectInput values from UI to Server code in R 使用来自服务器的MySQL数据更新Shiny R中的selectInput - updating selectInput in Shiny R with MySQL data from server r-从Shiny服务器到ui中的反应性selectInput(choices =)的输出 - r - Output from Shiny server to reactive selectInput(choices = ) in ui
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM