length
Since: DataTables 1.10
Page length change event - fired when the page length is changed.
Description
The length event is fired whenever the table's page length is changed. This can be through user interaction with the built in page length control, or via the API.
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, len )
Parameters:
| Name | Type | Optional | |
|---|---|---|---|
| 1 | e | No | |
Event object | |||
| 2 | settings | No | |
DataTables settings object | |||
| 3 | len | No | |
New page length | |||
Example
Write to console on page length change:
let table = new DataTable('#myTable');
table.on('length', function (e, settings, len) {
console.log('New page length: ' + len);
});Related
The following options are directly related and may also be useful in your application development.