Merge pull request #3502 from FlipWarthog/PV3443
Fix #3443: Datatable: RowReorder fails in case of pagination on page other than first & lastpull/3594/head
commit
4998bb70c2
|
@ -1685,7 +1685,7 @@ export default {
|
|||
let dropIndex = this.draggedRowIndex > this.droppedRowIndex ? this.droppedRowIndex : this.droppedRowIndex === 0 ? 0 : this.droppedRowIndex - 1;
|
||||
let processedData = [...this.processedData];
|
||||
|
||||
ObjectUtils.reorderArray(processedData, this.draggedRowIndex, dropIndex);
|
||||
ObjectUtils.reorderArray(processedData, this.draggedRowIndex + this.d_first, dropIndex + this.d_first);
|
||||
|
||||
this.$emit('row-reorder', {
|
||||
originalEvent: event,
|
||||
|
|
|
@ -106,15 +106,10 @@ export default {
|
|||
},
|
||||
|
||||
reorderArray(value, from, to) {
|
||||
let target;
|
||||
|
||||
if (value && from !== to) {
|
||||
if (to >= value.length) {
|
||||
target = to - value.length;
|
||||
|
||||
while (target-- + 1) {
|
||||
value.push(undefined);
|
||||
}
|
||||
to %= value.length;
|
||||
from %= value.length;
|
||||
}
|
||||
|
||||
value.splice(to, 0, value.splice(from, 1)[0]);
|
||||
|
|
Loading…
Reference in New Issue