I want to have the paging displayed at the bottom left side of the table and found that in JS, the DT layout option seems to do exactly that. However, I haven't found a way to use in R nor someone asking about it.
Here is the desired output (edited with GIMP) :
Here is my attempt at reproducing it with the layout
option :
library(DT)
datatable(
iris,
options = list(
layout = list(
topStart = "pageLength",
bottomStart = "info",
bottom2Start = "paging"
)
)
)
As Jan pointed out, the layout
option is not yet available for the R DT
package. In the meantime, I managed to get the layout I was looking for with the following CSS code.
If you wish to use it for elements other than the info and paging, don't forget to inspect the webpage of you shiny app to get its exact class.
Here is the Shiny App with CSS styling :
library(shiny)
library(DT)
library(tidyverse)
ui <- basicPage(
DTOutput("dummyTable", fill = TRUE),
tags$style(
HTML(".dataTables_wrapper .dataTables_paginate {
float: left}
.dataTables_wrapper .dataTables_info {
float: right}")
)
)
server <- function(input, output, session) {
output$dummyTable <- renderDT({
datatable(iris, options = list(dom = "l<t>ipr"))
})
session$onSessionEnded(function() {stopApp()})
}
shinyApp(ui, server)