column().init()
Get the initialisation options for a column.
Description
This method provides access to the initialisation object that was used to create the DataTable. Its intended use is for plug-in authors who wish to be able to provide column specific customisation options for their DataTables plug-ins. It is particularly useful in the case of columns since it returns the combined object resulting from columnDefs
and columns
initialisation options, as resolved by DataTables.
When developing with this method keep in mind that the DataTables options are all all optional. They may or may not exist in this object and therefore you should have default values if a property does not exist.
The object returned should never be written to - it will contain properties internal to DataTables which are not documented. They are internal and may change between versions.
Use only your own parameters. Due to the way DataTables works internally for backwards compatibility, this object will likely contain both camelCase initialisation options and Hungarian notation versions of the same parameters as well as other internal properties. Use of those parameters is not supported.
This method is not multi-table aware - it will return the configuration object used for the first table in the context if there is more than one table - use the iterator()
method if you require the configuration objects from all tables in a multi-table context.
Type
function columns().init()
- Description:
Get the initialisation options used for a column.
- Returns:
Configuration object
Example
Get a property from a column:
let table = new DataTable('#myTable', {
columnDefs: [
{
target: 1,
customProp: true
}
]
});
table.column().init().customProp;
// returns `true`
Related
The following options are directly related and may also be useful in your application development.