Fixed #1098 - Column Reorder and Toggle support for Table

pull/1196/head^2
mertsincan 2021-05-15 15:27:58 +03:00
parent 5169491ffc
commit bf114576b1
1 changed files with 7 additions and 7 deletions

View File

@ -384,12 +384,6 @@ export default {
}
},
mounted() {
if (this.reorderableColumns) {
let columnOrder = [];
this.columns.forEach(col => columnOrder.push(this.columnProp(col, 'columnKey')||this.columnProp(col, 'field')));
this.d_columnOrder = columnOrder;
}
if (this.scrollable && this.scrollDirection !== 'vertical') {
this.updateScrollWidth();
}
@ -1196,7 +1190,8 @@ export default {
}
if (allowDrop) {
ObjectUtils.reorderArray(this.d_columnOrder, dragIndex, dropIndex);
ObjectUtils.reorderArray(this.columns, dragIndex, dropIndex);
this.updateReorderableColumns();
this.$emit('column-reorder', {
originalEvent: event,
@ -1582,6 +1577,11 @@ export default {
return cloned;
},
updateReorderableColumns() {
let columnOrder = [];
this.columns.forEach(col => columnOrder.push(this.columnProp(col, 'columnKey')||this.columnProp(col, 'field')));
this.d_columnOrder = columnOrder;
},
updateScrollWidth() {
this.$refs.table.style.width = this.$refs.table.scrollWidth + 'px';
},