V3 migration for Table Reordering

pull/496/head
Cagatay Civici 2020-09-24 11:05:14 +03:00
parent 8164fbe703
commit effb19203a
2 changed files with 5 additions and 11 deletions

View File

@ -7,7 +7,7 @@
<DTCheckbox :value="rowData" :checked="selected" @change="toggleRowWithCheckbox" v-else-if="column.props.selectionMode ==='multiple'" />
</template>
<template v-else-if="column.props.rowReorder">
<i :class="['p-datatable-reorderablerow-handle', column.props.rowReorderIcon]"></i>
<i :class="['p-datatable-reorderablerow-handle', (column.props.rowReorderIcon || 'pi pi-bars')]"></i>
</template>
<template v-else-if="column.props.expander">
<button class="p-row-toggler p-link" @click="toggleRow" type="button" v-ripple>

View File

@ -433,13 +433,9 @@ export default {
mounted() {
if (this.reorderableColumns) {
let columnOrder = [];
const children = this.$slots.default();
for (let child of children) {
if (child.type.name === 'column') {
columnOrder.push(child.props.columnKey||child.props.field);
}
}
this.columns.forEach(col => columnOrder.push(col.props.columnKey||col.props.field));
this.d_columnOrder = columnOrder;
console.log()
}
},
beforeUnmount() {
@ -1136,7 +1132,7 @@ export default {
const event = e.originalEvent;
const column = e.column;
if (this.reorderableColumns && column.reorderableColumn) {
if (this.reorderableColumns && column.props.reorderableColumn !== false) {
if (event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA' || DomHandler.hasClass(event.target, 'p-column-resizer'))
event.currentTarget.draggable = false;
else
@ -1670,9 +1666,7 @@ export default {
}
}
return [...orderedColumns, ...cols.filter((item) => {
return orderedColumns.indexOf(item) < 0;
})];
return [...orderedColumns, ...cols.filter((item) => orderedColumns.indexOf(item) < 0)];
}
return cols;