{hero}

columns.className

Since: DataTables 1.10

Class to assign to each cell in the column.

Description

Quite simply this option adds a class to each cell in a column, regardless of if the table source is from DOM, Javascript or Ajax. This can be useful for styling columns.

Type

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

Examples

Using className to assign a class to the cells in the first column with columnDefs:

new DataTable('#myTable', {
	columnDefs: [{ className: 'my_class', targets: [0] }]
});

Using className to assign a class to the cells in the first column with columns:

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