columns.title

Since: DataTables 1.10

Set the column title.

Description

The titles of columns are typically read directly from the DOM (from the cells in the THEAD element), but it can often be useful to either override existing values, or have DataTables actually construct a header with column titles for you (for example if there is not THEAD element in the table before DataTables is constructed). This option is available to provide that ability.

Please note that when constructing a header, DataTables can only construct a simple header with a single cell for each column. Complex headers with colspan and rowspan attributes must either already be defined in the document, or be constructed using standard DOM / jQuery methods.

Type

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

Default

Value read from the column's header cell.

Examples

Set the first column's title with columnDefs:

$('#example').dataTable( {
  "columnDefs": [
    { "title": "My column title", "targets": 0 }
  ]
} );

Set the first column's title with columns:

$('#example').dataTable( {
  "columns": [
    { "title": "My column title" },
    null,
    null,
    null,
    null
  ]
} );