column-sizing
Column sizing event - fired when the column widths are recalculated.
Description
This event is fired whenever DataTables adjusts the column widths in the table and can be used by plug-ins to adjust any additional DOM elements they might have drawn on the page to take account of those changes.
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 )
- Parameters:
Name Type Optional 1 e
No jQuery event object
2 settings
No DataTables settings object
Example
Notify when the column widths are recalculated:
let table = new DataTable('#myTable');
table.on('column-sizing.dt', function (e, settings) {
console.log('Column width recalculated in table');
});
Related
The following options are directly related and may also be useful in your application development.