【问题标题】:Stop Shiny DT column widths jumping when filtering a factor column过滤因子列时停止闪亮的 DT 列宽跳跃
【发布时间】:2021-02-06 01:16:24
【问题描述】:

此示例中的 Species 列是因子,DT 使用类似于 selectize 的小部件进行过滤。只有在过滤框中单击才会使列宽跳跃。有谁知道如何抑制这种行为?

require(shiny)
require(DT)

shinyApp(
  ui = fluidPage(DTOutput("data_tbl")), 
  server = function(input, output, session) {
    output$data_tbl <- renderDT(filter = "top", iris, 
                                options = list(autoWidth = FALSE, bAutoWidth = FALSE))
  }
)

【问题讨论】:

    标签: r shiny dt


    【解决方案1】:

    autoWidth=TRUE 将解决您的问题。

    shinyApp(
      ui = fluidPage(DTOutput("data_tbl")), 
      server = function(input, output, session) {
        output$data_tbl <- renderDT(iris, filter = "top", 
                                    options = list(autoWidth = TRUE, bAutoWidth = FALSE))
      }
    )
    

    【讨论】:

      猜你喜欢
      • 2016-01-02
      • 2015-09-28
      • 2018-11-01
      • 2018-07-02
      • 2016-05-12
      • 2016-08-18
      • 2018-10-04
      • 2021-08-28
      • 2021-09-02
      相关资源
      最近更新 更多