V3 migration for Table Reordering
parent
8164fbe703
commit
effb19203a
|
@ -7,7 +7,7 @@
|
||||||
<DTCheckbox :value="rowData" :checked="selected" @change="toggleRowWithCheckbox" v-else-if="column.props.selectionMode ==='multiple'" />
|
<DTCheckbox :value="rowData" :checked="selected" @change="toggleRowWithCheckbox" v-else-if="column.props.selectionMode ==='multiple'" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else-if="column.props.rowReorder">
|
<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>
|
||||||
<template v-else-if="column.props.expander">
|
<template v-else-if="column.props.expander">
|
||||||
<button class="p-row-toggler p-link" @click="toggleRow" type="button" v-ripple>
|
<button class="p-row-toggler p-link" @click="toggleRow" type="button" v-ripple>
|
||||||
|
|
|
@ -433,13 +433,9 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.reorderableColumns) {
|
if (this.reorderableColumns) {
|
||||||
let columnOrder = [];
|
let columnOrder = [];
|
||||||
const children = this.$slots.default();
|
this.columns.forEach(col => columnOrder.push(col.props.columnKey||col.props.field));
|
||||||
for (let child of children) {
|
|
||||||
if (child.type.name === 'column') {
|
|
||||||
columnOrder.push(child.props.columnKey||child.props.field);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.d_columnOrder = columnOrder;
|
this.d_columnOrder = columnOrder;
|
||||||
|
console.log()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeUnmount() {
|
beforeUnmount() {
|
||||||
|
@ -1136,7 +1132,7 @@ export default {
|
||||||
const event = e.originalEvent;
|
const event = e.originalEvent;
|
||||||
const column = e.column;
|
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'))
|
if (event.target.nodeName === 'INPUT' || event.target.nodeName === 'TEXTAREA' || DomHandler.hasClass(event.target, 'p-column-resizer'))
|
||||||
event.currentTarget.draggable = false;
|
event.currentTarget.draggable = false;
|
||||||
else
|
else
|
||||||
|
@ -1670,9 +1666,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [...orderedColumns, ...cols.filter((item) => {
|
return [...orderedColumns, ...cols.filter((item) => orderedColumns.indexOf(item) < 0)];
|
||||||
return orderedColumns.indexOf(item) < 0;
|
|
||||||
})];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cols;
|
return cols;
|
||||||
|
|
Loading…
Reference in New Issue