Skip to content

Commit

Permalink
Fixed #6910, Fixed #7730
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Jun 3, 2019
1 parent 3043069 commit 023a2c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/components/table/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,7 @@ export class Table implements OnInit, AfterViewInit, AfterContentInit, Blockable

this.onRowReorder.emit({
dragIndex: this.draggedRowIndex,
dropIndex: this.droppedRowIndex
dropIndex: dropIndex
});
}
//cleanup
Expand Down
10 changes: 4 additions & 6 deletions src/app/components/utils/objectutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,10 @@ export class ObjectUtils {

public static reorderArray(value: any[], from: number, to: number) {
let target: number;
if(value && (from !== to)) {
if(to >= value.length) {
target = to - value.length;
while((target--) + 1) {
value.push(undefined);
}
if (value && from !== to) {
if (to >= value.length) {
to %= value.length;
from %= value.length;
}
value.splice(to, 0, value.splice(from, 1)[0]);
}
Expand Down

0 comments on commit 023a2c5

Please sign in to comment.