Skip to content

Commit

Permalink
Fixed #1098 - Column Reorder and Toggle support for Table
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed May 15, 2021
1 parent 5169491 commit bf11457
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/datatable/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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';
},
Expand Down

0 comments on commit bf11457

Please sign in to comment.