简体   繁体   English

如何更改 Shiny DT 中 lengthMenu 的 position

[英]How to change position of lengthMenu in Shiny DT

Like this thread here , I need to alter the position of my lengthMenu option in my datatable.这里的这个线程一样,我需要在我的数据表中更改我的 lengthMenu 选项的 position。 However, I am using Shiny and am not very well versed in JS.但是,我使用的是 Shiny 并且不太精通 JS。 How can I move the lengthMenu from the bottom of my table to the top?如何将 lengthMenu 从表格底部移动到顶部?

library(shiny)
library(DT)
shinyApp(
  ui = fluidPage(DTOutput('tbl')),
  server = function(input, output) {
    output$tbl <- renderDT(
      DT::datatable(iris,
                    selection = "none",
                    plugins = "ellipsis",
                    escape = FALSE,
                    rownames = FALSE,
                    options = list(
                      dom = 'rtipl', #https://datatables.net/reference/option/dom
                      scrollX=TRUE,
                      autoWidth = TRUE,
                      searching=FALSE,
                      ordering=TRUE,
                      bFilter = FALSE,
                      pageLength = 20,
                      lengthMenu = c(5, 10, 15, 20, 25, 30, 35, 40, 45, 50))
      ))
    # )
  }
)

Change dom = 'rtipl' to dom = 'lrtip' .dom = 'rtipl'更改为dom = 'lrtip' The letter l denotes the length menu.字母l表示长度菜单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM