From c631e74f5d0cfc8a5bbe5f595fba3c07a9d6a8df Mon Sep 17 00:00:00 2001 From: lelo Date: Wed, 18 Jun 2025 13:57:13 +0200 Subject: [PATCH] summenspalte --- app/templates/index.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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(); }