join()
Join the elements in the result set into a string.
Description
This method operates in exactly the same way as the JavaScript array join method, combining the contents of the array (in this case the API instance) into a single string.
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.join 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
join( separator )
Join the elements in the API instance's result set into a string.
Parameters:
| Name | Type | Optional | |
|---|---|---|---|
| 1 | separator | No | |
| The string that will be used to separate each element of the result set. | |||
Returns:
string: Contents of the instance's result set joined together as a single string.
Example
Create a comma separated string of the data in a column:
var table = new DataTable('#myTable');
var combinedData = table
	.column(0)
	.data()
	.join(', ');