DT闪亮表中的强制列宽

时间:2018-10-15 12:09:24

标签: r dt

我正在尝试设置'F'列的宽度以删除列之间的间隔。我正在使用columnDef width,但是看起来有一个最小宽度(在img中显示)。

我可以强迫宽度变小吗?

表格:

datatable(data = data, class = 'stripe', rownames = FALSE, filter = 'bottom', escape = FALSE, extensions = c('Scroller'),
              options = list(dom = 'Rlfrtip', autoWidth = TRUE, scrollX = TRUE, scrollY = 350, pagelength=50, lengthMenu = c(50,100,200,400),
                             initComplete = JS(
                                 "function(settings, json) {",
                                 "$(this.api().table().header()).css({'background-color': '#0892d0', 'color': '#fff'});",
                                 "}"
                             ),
                             columnDefs = list(
                                 list(width = '20px', className = 'dt-center', targets = c(0))
                             )
              )
    ) %>% DT::formatCurrency(
        columns = 'Importe', currency = ' €', dec.mark = ',', mark = '.', digits = 2, before = FALSE 
    )

enter image description here

0 个答案:

没有答案