summenspalte
This commit is contained in:
parent
f3aa4d781b
commit
c631e74f5d
@ -176,8 +176,21 @@
|
|||||||
columns: cols,
|
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();
|
if (table) table.destroy();
|
||||||
table = new Tabulator('#table', opts);
|
table = new Tabulator('#table', {
|
||||||
|
...opts,
|
||||||
|
columns: cols,
|
||||||
|
});
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err); alert('Failed to load table data');
|
console.error(err); alert('Failed to load table data');
|
||||||
} finally { hideLoading(); }
|
} finally { hideLoading(); }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user