fixed Table bug when remove a row of data
when Cell has a button to delete row data, clickCurrentRow will throw an error, so clone a data
This commit is contained in:
parent
99d0429e27
commit
63f2e0f4c4
1 changed files with 10 additions and 5 deletions
|
@ -173,7 +173,8 @@
|
||||||
bodyHeight: 0,
|
bodyHeight: 0,
|
||||||
bodyRealHeight: 0,
|
bodyRealHeight: 0,
|
||||||
scrollBarWidth: getScrollBarSize(),
|
scrollBarWidth: getScrollBarSize(),
|
||||||
currentContent: this.content
|
currentContent: this.content,
|
||||||
|
cloneData: deepCopy(this.data) // when Cell has a button to delete row data, clickCurrentRow will throw an error, so clone a data
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -357,16 +358,16 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.objData[_index]._isHighlight = true;
|
this.objData[_index]._isHighlight = true;
|
||||||
const oldData = oldIndex < 0 ? null : JSON.parse(JSON.stringify(this.data[oldIndex]));
|
const oldData = oldIndex < 0 ? null : JSON.parse(JSON.stringify(this.cloneData[oldIndex]));
|
||||||
this.$emit('on-current-change', JSON.parse(JSON.stringify(this.data[_index])), oldData);
|
this.$emit('on-current-change', JSON.parse(JSON.stringify(this.cloneData[_index])), oldData);
|
||||||
},
|
},
|
||||||
clickCurrentRow (_index) {
|
clickCurrentRow (_index) {
|
||||||
this.highlightCurrentRow (_index);
|
this.highlightCurrentRow (_index);
|
||||||
this.$emit('on-row-click', JSON.parse(JSON.stringify(this.data[_index])));
|
this.$emit('on-row-click', JSON.parse(JSON.stringify(this.cloneData[_index])));
|
||||||
},
|
},
|
||||||
dblclickCurrentRow (_index) {
|
dblclickCurrentRow (_index) {
|
||||||
this.highlightCurrentRow (_index);
|
this.highlightCurrentRow (_index);
|
||||||
this.$emit('on-row-dblclick', JSON.parse(JSON.stringify(this.data[_index])));
|
this.$emit('on-row-dblclick', JSON.parse(JSON.stringify(this.cloneData[_index])));
|
||||||
},
|
},
|
||||||
getSelection () {
|
getSelection () {
|
||||||
let selectionIndexes = [];
|
let selectionIndexes = [];
|
||||||
|
@ -663,6 +664,10 @@
|
||||||
this.objData = this.makeObjData();
|
this.objData = this.makeObjData();
|
||||||
this.rebuildData = this.makeDataWithSortAndFilter();
|
this.rebuildData = this.makeDataWithSortAndFilter();
|
||||||
this.handleResize();
|
this.handleResize();
|
||||||
|
// here will trigger before clickCurrentRow, so use async
|
||||||
|
setTimeout(() => {
|
||||||
|
this.cloneData = deepCopy(this.data);
|
||||||
|
}, 0);
|
||||||
},
|
},
|
||||||
deep: true
|
deep: true
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue