DataTables example Alternative pagination

The default page control presented by DataTables (forward and backward buttons with up to 7 page numbers in-between) is fine for most situations, but there are cases where you may wish to customise the options presented to the end user. This is done through DataTables' extensible pagination mechanism, the pagingType option.

There are four built-in options for which pagination controls DataTables should show:

  • numbers - Page number buttons only
  • simple - 'Previous' and 'Next' buttons only
  • simple_numbers - 'Previous' and 'Next' buttons, plus page numbers
  • full - 'First', 'Previous', 'Next' and 'Last' buttons
  • full_numbers - 'First', 'Previous', 'Next' and 'Last' buttons, plus page numbers

The language strings of 'First', 'Previous' etc can be optionally through the internationalisation options of DataTables; language.paginate.first, language.paginate.previous etc.

Additional options for the buttons that are shown can be added through the use of pagination type plug-ins. Furthermore, how the buttons are actually shown can be altered through the use of plug-in pagination renderers.

The example below shows the full_numbers type of pagination.

The Javascript shown below is used to initialise the table shown in this example:

1
2
3
4
5
$(document).ready(function() {
    $('#example').DataTable( {
        "pagingType": "full_numbers"
    } );
} );

In addition to the above code, the following Javascript library files are loaded for use in this example: