You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
396 B
JavaScript
19 lines
396 B
JavaScript
/**
|
|
* Sum the values in a data set.
|
|
*
|
|
* @name sum()
|
|
* @summary
|
|
* @author [Allan Jardine](http://sprymedia.co.uk)
|
|
* @requires DataTables 1.10+
|
|
*
|
|
* @example
|
|
* table.column( 3 ).data().sum();
|
|
*/
|
|
|
|
jQuery.fn.dataTable.Api.register( 'sum()', function () {
|
|
return this.flatten().reduce( function ( a, b ) {
|
|
return (a*1) + (b*1); // cast values in-case they are strings
|
|
} );
|
|
} );
|
|
|