Skip to content

Commit

Permalink
fix(MdTable): remove table head when column removed (#1354)
Browse files Browse the repository at this point in the history
fix #1347
  • Loading branch information
VdustR authored and marcosmoura committed Dec 29, 2017
1 parent 8115f32 commit b54eb10
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/components/MdTable/MdTableCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
},
inject: ['MdTable'],
data: () => ({
index: null
index: null,
parentNode: null
}),
computed: {
cellClasses () {
Expand Down Expand Up @@ -50,7 +51,9 @@
})
},
updateAllCellData () {
const cells = Array.from(this.$el.parentNode.childNodes).filter(({ tagName, classList }) => {
this.MdTable.items = {}
const cells = Array.from(this.parentNode.childNodes).filter(({ tagName, classList }) => {
const isSelection = classList && classList.contains('md-table-cell-selection')
const isTd = tagName && tagName.toLowerCase() === 'td'
Expand All @@ -67,6 +70,16 @@
}
},
mounted () {
this.parentNode = this.$el.parentNode
this.updateAllCellData()
},
destroyed () {
const rowRemoved = this.$el.parentNode !== null
if (rowRemoved) {
return false
}
this.updateAllCellData()
}
}
Expand Down

0 comments on commit b54eb10

Please sign in to comment.