diff --git a/public/js/components/filter/Filter.js b/public/js/components/filter/Filter.js index 7fbeb84bc..cf0fcf5e1 100644 --- a/public/js/components/filter/Filter.js +++ b/public/js/components/filter/Filter.js @@ -83,7 +83,9 @@ export const CoreFilterCmpt = { fetchCmptDataFetched: null, tabulator: null, - tableBuilt: false + tableBuilt: false, + tabulatorHasSelector: false, + selectedData: [] }; }, computed: { @@ -130,6 +132,8 @@ export const CoreFilterCmpt = { { // If the column has to be displayed or not col.visible = selectedFields.indexOf(col.field) >= 0; + if (col.formatter == 'rowSelection') + col.visible = true; if (col.hasOwnProperty('resizable')) col.resizable = col.visible; @@ -182,6 +186,9 @@ export const CoreFilterCmpt = { tabulatorOptions.columns = this.filteredColumns; } + if (tabulatorOptions.columns && tabulatorOptions.columns.filter(el => el.formatter == 'rowSelection').length) + this.tabulatorHasSelector = true; + // Start the tabulator with the build options this.tabulator = new Tabulator( this.$refs.table, @@ -195,6 +202,9 @@ export const CoreFilterCmpt = { this.tabulator.on(evt.event, evt.handler); } this.tabulator.on('tableBuilt', () => this.tableBuilt = true); + this.tabulator.on("rowSelectionChanged", data => { + this.selectedData = data; + }); if (this.tableOnly) { this.tabulator.on('tableBuilt', () => { const cols = this.tabulator.getColumns(); @@ -213,6 +223,7 @@ export const CoreFilterCmpt = { }, _updateTabulator() { this.tabulator.setData(this.filteredData); + this.tabulatorHasSelector = this.filteredColumns.filter(el => el.formatter == 'rowSelection').length; this.tabulator.setColumns(this.filteredColumns); }, /** @@ -502,10 +513,12 @@ export const CoreFilterCmpt = { -
+
+ Mit {{selectedData.length}} ausgewählten: +