Skip to content

Commit

Permalink
docs(example): fix sort error when dragging rows (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonguo committed Jun 11, 2024
1 parent 8cdf3bf commit ddca3f4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/examples/DraggableTable.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ function sort(source, sourceId, targetId) {
const dragItem = source.find(item => item.id === sourceId);
const index = nextData.findIndex(item => item.id === targetId);

if (index === -1) {
return source;
}

nextData.splice(index, 0, dragItem);
return nextData;
}
Expand Down

0 comments on commit ddca3f4

Please sign in to comment.