Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect display of the sheet after dragend #1232

Open
rajabovdiyorbek opened this issue Nov 30, 2023 · 2 comments
Open

Incorrect display of the sheet after dragend #1232

rajabovdiyorbek opened this issue Nov 30, 2023 · 2 comments

Comments

@rajabovdiyorbek
Copy link

rajabovdiyorbek commented Nov 30, 2023

I implement changing the elements of the array during dragging using :move so that the order numbers change during movement, and not just at the end, but I have a problem with the display, if I change 9 and 1 element, then the order in the array by order will be correct, but in the browser the display
2 3 4 5 6 7 8 9 1

`onDragEnd() {
  this.isDragging = false;
  this.isChosen = false;
  this.draggedIndex = -1;
  this.myArray.sort((a, b) => a.order - b.order);
},
onMove(evt) {
  const draggedIndex = this.draggedIndex;
  const newIndex = evt.draggedContext.futureIndex;
  const movedElements = this.myArray.splice(draggedIndex, 1);
  this.myArray.splice(newIndex, 0, ...movedElements);
  this.draggedIndex = newIndex;

  for (let i = 0; i < this.myArray.length; i++) {
    this.myArray[i].order = i + 1;
  }
},`
@rajabovdiyorbek
Copy link
Author

@David-Desmaisons please can you help me?

@rajabovdiyorbek
Copy link
Author

if i try to display myList array in outside draggable my list shows by order correct, but not inside draggable, if i change oly two cars between alse works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant