column().width()
Get the width of a column.
Description
This method is a helper method to get the width of the column in a table. It can be used by extension authors who need to utalise the width of a column (for example the Buttons extension uses widths for the Excel and PDF export).
The result given is the "outer width" of the cells for the target column. If a column is hidden, is width will be returned as 0
.
The returned number might not be an integer, depending on the browser's table rendering.
Type
column().width()
Example
Get the width for a column that was clicked on:
let table = new DataTable('#example');
table.on('click', 'tbody td', function () {
let width = table.column(this).width();
alert('Column width: ' + width);
});
Related
The following options are directly related and may also be useful in your application development.