Reputation: 759
I'm working with a very long datatable and would like to place the pagination (1, 2, 3, ...15, next) at the top rather than the bottom of the table.
I know the DOM elements can be included/excluded as an option, but I don't see how to actually move them around.
How can a simple table like this move the pagination to the top?
library(DT)
datatable(iris)
Upvotes: 5
Views: 1925
Reputation: 5529
The "dom" argument passed as a list in the options argument to datatable seems to arrange things.
datatable(head(iris, 30), options = list(dom = '<lfp<t>i>'))
The t is for the table, p for pagination, between
<
and <
at the top, between >
and >
at the bottom.
datatable(head(iris, 30))
Upvotes: 2
Reputation: 31452
You can use dom options. See https://datatables.net/reference/option/dom for details on the various options available. To place pagination at top use:
datatable(iris, options = list(dom = '<"top" p>'))
If you also need other elements such as information and search, add them in the same way, e.g.
datatable(iris, options = list(dom = '<"top" pif>'))
Upvotes: 6