Skip to content

Commit f0b84dd

Browse files
committed
feat(QTable): add __index prop to rows
1 parent 6f7f934 commit f0b84dd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/components/table/QTable.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ export default {
6868
},
6969
computed: {
7070
computedRows () {
71-
let rows = this.data.slice()
71+
let rows = this.data.slice().map((row, i) => {
72+
row.__index = i
73+
return row
74+
})
7275

7376
if (rows.length === 0) {
7477
return []
@@ -79,7 +82,7 @@ export default {
7982

8083
const { sortBy, descending, rowsPerPage } = this.computedPagination
8184

82-
if (this.hasFilter && this.filter) {
85+
if (this.hasFilter) {
8386
rows = this.filterMethod(rows, this.filter, this.computedCols, this.getCellValue)
8487
}
8588

src/components/table/table-filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default {
1313
},
1414
computed: {
1515
hasFilter () {
16-
return this.filter !== void 0
16+
return this.filter !== void 0 && this.filter.length > 0
1717
}
1818
},
1919
watch: {

0 commit comments

Comments
 (0)