concat()
Combine multiple API instances to create a single new instance.
Description
The concat()
method will combine the result set of two or more DataTables API instances into a single API instance.
This method makes use of the fact that DataTables API objects are "array like", in that they inherit a lot of the abilities and methods of the Javascript Array
type. In this case, this method is a proxy for the Javascript Array.prototype.concat
method and is provided as a utility method for the DataTables API. For more information about the original method, please refer to the Mozilla MDN documentation for concat
.
Type
function concat( a [, b [, ... ] ] )
- Description:
Concatenate two or more API instances together
- Parameters:
Name Type Optional 1 a
No API instance to concatenate to the initial instance.
2 b
Yes - default: Additional API instance(s) to concatenate to the initial instance.
- Returns:
New API instance with the values from all passed in instances concatenated into its result set.
Example
Concat data from two sources:
var table = $('#example').DataTable();
var data = table.column( 0 ).data()
.concat( table.column( 1 ).data() );