Skip to content

Commit 5dc6003

Browse files
committed
fix: CDataTable: fix value props usage:
- sorter, columnFilter, tableFilter props do not have to be enabled to use sorterValue, columnFilterValue, tableFilterValue respectively
1 parent 216f023 commit 5dc6003

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/components/table/CDataTable.vue

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -305,16 +305,14 @@ export default {
305305
computed: {
306306
columnFiltered () {
307307
let items = this.passedItems.slice()
308-
if (this.columnFilter === true) {
309-
Object.entries(this.columnFilterState).forEach(([key, value]) => {
310-
if (value && this.rawColumnNames.includes(key)) {
311-
const columnFilter = String(value).toLowerCase()
312-
items = items.filter(item => {
313-
return String(item[key]).toLowerCase().includes(columnFilter)
314-
})
315-
}
316-
})
317-
}
308+
Object.entries(this.columnFilterState).forEach(([key, value]) => {
309+
if (value && this.rawColumnNames.includes(key)) {
310+
const columnFilter = String(value).toLowerCase()
311+
items = items.filter(item => {
312+
return String(item[key]).toLowerCase().includes(columnFilter)
313+
})
314+
}
315+
})
318316
return items
319317
},
320318
filterableCols () {
@@ -324,7 +322,7 @@ export default {
324322
},
325323
tableFiltered () {
326324
let items = this.columnFiltered.slice()
327-
if (this.tableFilter === true && this.tableFilterState) {
325+
if (this.tableFilterState) {
328326
const filter = this.tableFilterState.toLowerCase()
329327
const hasFilter = (item) => String(item).toLowerCase().includes(filter)
330328
items = items.filter(item => {
@@ -335,7 +333,7 @@ export default {
335333
},
336334
sortedItems () {
337335
const col = this.sorterState.column
338-
if (!col || this.sorter !== true || !this.rawColumnNames.includes(col)) {
336+
if (!col || !this.rawColumnNames.includes(col)) {
339337
return this.tableFiltered
340338
}
341339
//if values in column are to be sorted by numeric value they all have to be type number

0 commit comments

Comments
 (0)