Simple jQuery Plugin To Sum Table Columns - sumTable.js

Simple jQuery Plugin To Sum Table Columns - sumTable.js
File Size: 3.01 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

sumTable.js is a very small jQuery plugin that has the ability to sum a column of numbers in your html table just like the Excel's SUM formula.

How to use it:

1. Put the latest version of jQuery library and jQuery sumTable.js script at the bottom of the webpage.

<script src="//code.jquery.com/jquery-3.1.0.slim.min.js"></script>
<script src="sumTable.js"></script>

2. Just call the function sumTable() on the html table and the plugin will do the rest.

$("table").sumTable();

3. The plugin allows you to skip the first row when performing the calculating.

$("table").sumTable({
  "skipFirstColumn" : true
});

4. Change the default 'Total' text.

$("table").sumTable({
  "totalText" : 'Total'
});

5. Add extra CSS class(es) to the 'Total' row.

$("table").sumTable({
  totalClass: 'your-custom-class'
});

This awesome jQuery plugin is developed by mihamajetic. For more Advanced Usages, please check the demo page or visit the official website.