4

是否可以将水平滚动条添加到selectInput具有固定数量的项目(例如 size = 5)?

有些项目太长,无法完全显示,我不想更改selectInput.

我尝试添加它:

tags$head(tags$style(HTML('.shiny-bound-input{overflow-x: scroll;}')))

但没有成功......有什么解决办法吗?

library(shiny) 
u <- fluidPage(   

  tags$head(tags$style(HTML('.shiny-bound-input{overflow-x: scroll;}'))),

  selectInput(inputId = "in", label = "Choose", choices = c('Short','A very short sentence.'), 
              selectize = F, size = 5, width = "150px")

)

s <- function(input,output){} 

shinyApp(ui=u,server=s)

编辑:它似乎依赖于浏览器。例如在 Opera 和 Chrome 中是一个单杠。在 Firefox 和 IE 中没有。

4

0 回答 0