page
Page change event - fired when the table's paging is updated.
Description
The page event is fired when table's paging state changes. This can be the end user selecting the page to view, or when the page state is altered by the API (page()).
Note that the page will be fired before the table has been redrawn with the updated data.
If your table offers the user the ability to change the page length, you might also want to listen for length to know when the page length has changed.
Please note that, as with all DataTables emitted events, the event object has a DataTables API instance available on it in the dt property.
Type
function( e, settings )
Parameters:
| Name | Type | Optional | |
|---|---|---|---|
| 1 | e | No | |
Event object | |||
| 2 | settings | No | |
DataTables settings object | |||
Example
Show information about the current page using the API:
var table = new DataTable('#myTable');
table.on('page', function () {
var info = table.page.info();
document.querySelector('#pageInfo').textContent =
'Showing page: ' + info.page + ' of ' + info.pages;
});Related
The following options are directly related and may also be useful in your application development.