小编Stu*_*ent的帖子

闪亮数据表中的标题方向

我在我的闪亮应用程序中使用 DT 一段时间了。我想知道当文本很长时是否有任何选项(简单的方法)可以更改表标题方向(例如将所有列名旋转 45 度或其他),当表中有很多列时,这是一个问题。谢谢,这是一个简短的例子:

library(shiny)
library(DT)
ui <- fluidPage(
  mainPanel(
    tabsetPanel(
      tabPanel("Table", br(),
               dataTableOutput("myTable"))
    ), width = 9
  )
)

server <- function(input, output) {
  output$myTable <- renderDataTable({
  test <- data.frame(1:20, letters[1:20], stringsAsFactors = FALSE)
  colnames(test) <- c("This is a long name", "This column name is much more longer!")
  datatable(test, rownames = FALSE, options = list(autoWidth = TRUE, searching = TRUE, lengthMenu = list(c(5, 10, 25, 50, -1), c('5', '10', '25', '50', 'All')), pageLength = 10)) # %>% formatStyle(names(test)) …
Run Code Online (Sandbox Code Playgroud)

css r datatables dt

2
推荐指数
1
解决办法
1867
查看次数

标签 统计

css ×1

datatables ×1

dt ×1

r ×1