push()
Add one or more items to the end of an API instance's result set.
Description
Just as with Javascript arrays', since the DataTables API object is "array like", items can be added to a result set using this method. Pushing an item onto an API instance adds it to the end of the result set. Items can be added at the start of the result set using unshift()
if required.
This method is a proxy for the Javascript Array.prototype.push
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 push
.
Type
function push( value_1 [, value_2 [, ...] ] )
- Description:
Add one or more items to the end of an API instance's result set.
- Parameters:
Name Type Optional 1 value_1
Any
No Item to add to the API instance's result set.
2 value_2
Any
No Additional item(s) to add to the API instance's result set. Use as many parameters as you require to add additional items.
- Returns:
The length of the modified API instance
Example
Add a value to an array returned for a column's data.:
var table = new DataTable('#myTable');
var data = table.column(0).data();
data.push('Fini');