Skip to content

Commit b54eb10

Browse files
VdustRmarcosmoura
authored andcommitted
fix(MdTable): remove table head when column removed (#1354)
fix #1347
1 parent 8115f32 commit b54eb10

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/components/MdTable/MdTableCell.vue

+15-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
},
1818
inject: ['MdTable'],
1919
data: () => ({
20-
index: null
20+
index: null,
21+
parentNode: null
2122
}),
2223
computed: {
2324
cellClasses () {
@@ -50,7 +51,9 @@
5051
})
5152
},
5253
updateAllCellData () {
53-
const cells = Array.from(this.$el.parentNode.childNodes).filter(({ tagName, classList }) => {
54+
this.MdTable.items = {}
55+
56+
const cells = Array.from(this.parentNode.childNodes).filter(({ tagName, classList }) => {
5457
const isSelection = classList && classList.contains('md-table-cell-selection')
5558
const isTd = tagName && tagName.toLowerCase() === 'td'
5659
@@ -67,6 +70,16 @@
6770
}
6871
},
6972
mounted () {
73+
this.parentNode = this.$el.parentNode
74+
this.updateAllCellData()
75+
},
76+
destroyed () {
77+
const rowRemoved = this.$el.parentNode !== null
78+
79+
if (rowRemoved) {
80+
return false
81+
}
82+
7083
this.updateAllCellData()
7184
}
7285
}

0 commit comments

Comments
 (0)