diff --git a/assets/js/stippletables.js b/assets/js/stippletables.js index 476cea5..2b9bd5c 100644 --- a/assets/js/stippletables.js +++ b/assets/js/stippletables.js @@ -3,7 +3,7 @@ Vue.component("st-table", {
[''] } }, inheritAttrs: false, @@ -166,7 +170,8 @@ Vue.component("st-table", { selectedColumns: [], isFullscreen: false, selectedGroupSelect: null, - groupbyisBound: false + groupbyisBound: false, + aggregatebyisBound: false }; }, computed: { @@ -198,7 +203,7 @@ Vue.component("st-table", { return searchColumns.some(colName => { let value = row[colName]; console.log(`Checking column ${colName}:`, value); - + // Skip null or undefined values if (value == null) return false; @@ -206,6 +211,17 @@ Vue.component("st-table", { return String(value).toLowerCase().includes(this.filter.toLowerCase()); }); }); + }, + formattedColumns() { + return this.columns.map(col => { + if (this.currencycolumns.includes(col.name)) { + return { + ...col, + format: this.formatCurrency + }; + } + return col; + }); } }, methods: { @@ -215,6 +231,17 @@ Vue.component("st-table", { toggleFullscreen() { this.isFullscreen = !this.isFullscreen; }, + formatCurrency(value) { + if (typeof value !== 'number') { + return value; + } + return new Intl.NumberFormat('en-US', { + style: 'currency', + currency: 'USD', + minimumFractionDigits: 2, + maximumFractionDigits: 2 + }).format(value); + } }, created() { // Check if groupby prop is bound