Skip to content

Commit

Permalink
fix: CDataTable: fix value props usage:
Browse files Browse the repository at this point in the history
- sorter, columnFilter, tableFilter props do not have to be enabled to use sorterValue,  columnFilterValue, tableFilterValue respectively
  • Loading branch information
woothu committed Dec 30, 2019
1 parent 216f023 commit 5dc6003
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/components/table/CDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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 => {
Expand All @@ -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
Expand Down

0 comments on commit 5dc6003

Please sign in to comment.