From 5dc6003f9a273dc01751e4b67f2201e4a78acc0c Mon Sep 17 00:00:00 2001 From: woothu <32914662+woothu@users.noreply.github.com> Date: Mon, 30 Dec 2019 18:46:40 +0100 Subject: [PATCH] fix: CDataTable: fix value props usage: - sorter, columnFilter, tableFilter props do not have to be enabled to use sorterValue, columnFilterValue, tableFilterValue respectively --- src/components/table/CDataTable.vue | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/components/table/CDataTable.vue b/src/components/table/CDataTable.vue index 0caa2fa4..1eb11866 100644 --- a/src/components/table/CDataTable.vue +++ b/src/components/table/CDataTable.vue @@ -305,16 +305,14 @@ export default { computed: { columnFiltered () { let items = this.passedItems.slice() - if (this.columnFilter === true) { - Object.entries(this.columnFilterState).forEach(([key, value]) => { - if (value && this.rawColumnNames.includes(key)) { - const columnFilter = String(value).toLowerCase() - items = items.filter(item => { - return String(item[key]).toLowerCase().includes(columnFilter) - }) - } - }) - } + Object.entries(this.columnFilterState).forEach(([key, value]) => { + if (value && this.rawColumnNames.includes(key)) { + const columnFilter = String(value).toLowerCase() + items = items.filter(item => { + return String(item[key]).toLowerCase().includes(columnFilter) + }) + } + }) return items }, filterableCols () { @@ -324,7 +322,7 @@ export default { }, tableFiltered () { let items = this.columnFiltered.slice() - if (this.tableFilter === true && this.tableFilterState) { + if (this.tableFilterState) { const filter = this.tableFilterState.toLowerCase() const hasFilter = (item) => String(item).toLowerCase().includes(filter) items = items.filter(item => { @@ -335,7 +333,7 @@ export default { }, sortedItems () { const col = this.sorterState.column - if (!col || this.sorter !== true || !this.rawColumnNames.includes(col)) { + if (!col || !this.rawColumnNames.includes(col)) { return this.tableFiltered } //if values in column are to be sorted by numeric value they all have to be type number