R Shiny 选择 : How to set the minimum number of options in selectizeInput

标签 r shiny selectize.js

在 Shiny 中使用 selectizeInput 时,我试图增加下拉列表的长度。

我知道我可以设置显示的最大项目数:options = list(maxOptions = n)但是我怎么能定义最少数量的选项呢?

最佳答案

正如评论中所说,没有最少数量的选项设置,至少我知道没有。但是,由于您正在尝试增加下拉列表的长度,因此您可以使用 CSS 来实现。

假设这是您的下拉列表:

  selectizeInput("select", "Select multiple options",
             choices = LETTERS, multiple = T
             ),

只需添加:
  tags$style(type='text/css', 
         ".selectize-dropdown-content {
                                       max-height: 600px; ## CHANGE THIS
                                       }"
         ) 

你会得到:

long

作为一个最小的例子,试试这个:
library(shiny)

ui <- fluidPage(

  selectizeInput("select", "Select multiple options",
                 choices = LETTERS, multiple = T
                 ),
  tags$style(type='text/css', 
             ".selectize-dropdown-content {
                                           max-height: 600px; 
                                           }"
             )   
)

server <- function(input, output){}

shinyApp(ui=ui, server=server)

关于R Shiny 选择 : How to set the minimum number of options in selectizeInput,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25843638/

相关文章:

javascript - 多个 <select> 使用 selectize,已选择时删除选项

r - 如何使用plotmath 将一个表达式放在另一个表达式之上

r - 如何为 R shiny App 连续旋转 3D Plotly

c# - Selectize.js 不从服务器呈现选项

javascript - 如何将 aria-label 添加到 selectize.js?

html - 在 R shiny 中创建 HTML 表格

r - data.table 图中的 X Axis 配置

r - 将 char* 转换为 SEXP

r - 裁剪和 mask 光栅堆栈的并行处理速度较慢

r - 我不断收到此错误 “docker: invalid reference format: repository name must be lowercase.”