Jquery Datatables - Pagination Number Quantity

Asked

Viewed 4,896 times

2

I’m implementing the Datatables pagination and I couldn’t figure out how to modify the number of pagination buttons.

inserir a descrição da imagem aqui

As you can see, we have to 1 to 5, or we might have to 7 to 11 the numbers of the Page, that is, always 5 numbers. I’d like to show 10 numbers, for example: 1 to 10 or 3 to 13 or 7 to 17 or 11 to 21, etc..

I hope I’ve been clear! Thank you.

2 answers

3


You can change the number of pages that appear by changing the variable jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages, which by default is 5. Ex.

jQuery.fn.dataTableExt.oPagination.iFullNumbersShowPages = 10;
$('#my-table').extend.dataTable({
    "bPaginate": true,
    "sPaginationType": "bootstrap",
    "bScrollCollapse": true
});

Following link with explanation (in English): http://www.sprymedia.co.uk/dataTables-1.4/example_alt_pagination.html

2

A simpler way would be to configure the "iDisplayLength" property of the datatable component. Like this:

$('#dtPagina').dataTable({                         
  "iDisplayLength": 100                         
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.