'Vue Table with draggable rows won't get exported reordered
High I'm new at programming in Vue, but I want to use Vue Leaflet. So I made thiggs simplified version of my program which highlights a major programming problem I have.
The code
See link: https://codesandbox.io/s/icy-shadow-xpxzww?file=/index.html
The goal
To make a table
1. with draggable rows
2. with data which can be imported
3. with data which can be added and removed
4. And then the data can be reordered
5. And then export the data
6. And do it all in html and js
What I have done so far
I had no problems with everything except for number 4. I tried vue.draggable, however I could not get it to reorder at all. So I used the HTML Drag and Drop API (https://www.w3schools.com/html/html5_draganddrop.asp). When you select a row, the first column will restart with counting the indices from top to bottom. But that leads to the problem.
The problem
My code doesn't have a function or method which sends info about the reordering of the rows to the save file function and I do not see how I can implement that. Can someone help me out? Thanks in advance.
Solution 1:[1]
Change the dragover function so that it includes the array.splice function from this youtube clip from webdevtv: https://www.youtube.com/watch?v=syfUi_n-tv8
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Koen Bronstring |