Reputation: 4283
When using the DataTables plugin
How would I make the paging and the Showing 1 to 8 of 8 entries appear at the top rather than the bottom?
Thanks
Upvotes: 2
Views: 5908
Reputation: 60
I may be late, but I found the below code more suitable and can be customized based on our needs using the dataTable dom options
$('#example').dataTable( {
"dom": '<"top"i>rt<"bottom"flp><"clear">'
} );
Reference Link - https://datatables.net/reference/option/dom
Upvotes: 0
Reputation: 31
just add dom property in option as lfrtip to lfript
var dataTable = $('#example').dataTable({
sPaginationType: "full_numbers",
dom:"lfrtip"
});,
this will move the info and pagination on the top of the table
see the documentation https://datatables.net/reference/option/dom
Upvotes: 3
Reputation: 85558
Every datatable control is named with unique id
's after the scheme <tableid>_info
, <tableid>_pagination
and so on. So they are easy to locate and then move around.
If you have a table #example
you would perhaps initialize the dataTable like this :
var dataTable = $('#example').dataTable({
sPaginationType: "full_numbers"
})
and after that, move the controls to above the table like this :
$("#example_info").detach().prependTo('#example_wrapper');
$("#example_paginate").detach().prependTo('#example_wrapper');
And for avoiding that the two controls are misaligned vertically :
#example_info {
clear: none;
}
see working fiddle -> http://jsfiddle.net/C6CWE/
Upvotes: 8