{hero}

columns.contentPadding

Since: DataTables 1.10

Add padding to the text content used when calculating the optimal width for a table.

Description

The first thing to say about this property is that generally you shouldn't need this!

Having said that, it can be useful on rare occasions. When DataTables calculates the column widths to assign to each column, it finds the longest string in each column and then constructs a temporary table and reads the widths from that. The problem with this is that "mmm" is much wider then "iiii", but the latter is a longer string - thus the calculation can go wrong (doing it properly and putting it into an DOM object and measuring that is horribly slow!). Thus as a "work around" we provide this option. It will append its value to the text that is found to be the longest string for the column - i.e. padding.

Type

This option can be given in the following type(s):

Example

Set a content padding for the last column in the table:

new DataTable('#myTable', {
	columns: [null, null, null, { contentPadding: 'mmm' }]
});

Related

The following options are directly related and may also be useful in your application development.