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

I don't want to change the id #36

Open
cn-xufei opened this issue Mar 17, 2018 · 1 comment
Open

I don't want to change the id #36

cn-xufei opened this issue Mar 17, 2018 · 1 comment

Comments

@cn-xufei
Copy link

handleDrop(data) {
console.log(':v-list: drop');
console.log(data);
const { index, list, item } = data;
// change the id
item.id = new Date().getTime();
list.splice(index, 0, item);
},
handleMoved(item) {
console.log(':v-draggable: moved');
console.log(item);
const { index, list } = item;
list.splice(index, 1);
},

@pschaub
Copy link

pschaub commented Mar 17, 2018

You may duplicate the id of all items to another field (e.g. item.vddlId) before using it with vddl. Then you can only change the vddl-internal id (item.vddlId) on that function. Just an idea as workaround.

Hint: The fastest way to deep-copy anything in javascript is this:

let realClone = JSON.parse(JSON.stringify(obj))

Source: https://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-deep-clone-an-object-in-javascript

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

2 participants