length
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 (the first parameter). Additionally, the events are triggered with the dt
namespace. As such, to listen for this event, you must also use the dt
namespace by simply appending .dt
to your event name, as shown in the example below.
Type
function function( e, settings, len )
- Parameters:
Name Type Optional 1 e
No jQuery 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.dt', 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.