Like this thread here, I need to alter the position of my lengthMenu option in my datatable. However, I am using Shiny and am not very well versed in JS. How can I move the lengthMenu from the bottom of my table to the top?
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))
))
# )
}
)
CodePudding user response:
Change dom = 'rtipl' to dom = 'lrtip'. The letter l denotes the length menu.
