diff --git a/app/templates/index.html b/app/templates/index.html
index 1eb4a73..09bc243 100644
--- a/app/templates/index.html
+++ b/app/templates/index.html
@@ -176,8 +176,21 @@
columns: cols,
};
+ // add sum_amount to the footer using column calculations
+ // If you want to sum the "amount" column, add a bottomCalc to the column definition
+ cols.forEach(col => {
+ if (col.field === 'amount') {
+ col.bottomCalc = 'sum';
+ col.bottomCalcFormatter = cell => cell.getValue().toFixed(2);
+ }
+ });
+ // Recreate table with updated columns
if (table) table.destroy();
- table = new Tabulator('#table', opts);
+ table = new Tabulator('#table', {
+ ...opts,
+ columns: cols,
+ });
+
} catch (err) {
console.error(err); alert('Failed to load table data');
} finally { hideLoading(); }