I'm trying out v1.0.0-beta4. After adding additional containers with javascript, I need to allow the items inside to be draggable. I tried addContainer, but it doesn't appear to add draggables. Am I doing something incorrect? Or is the only way to destroy and reinitialize?
Thanks for reporting! Weird, just tested the addContainer method and it works as expected. Do you have a code sample, so we can reproduce? Only workaround, _for you_, is to destroy and re-initialize.
Let me know
Thank you for the quick response. I made an example of the problem here: https://codepen.io/dsandstrom/pen/qxzWzv .
After adding a new container, I can drag existing items to it. However, I can not drag items out of the new container.
Thank you so much for the sample code 馃憤I see what the issue is now: https://github.com/Shopify/draggable/blob/master/src/Draggable/Draggable.js#L255
We are creating a new reference for this.containers in Draggable.js and our Sensors rely on the same reference!
This could have been prevented if we had better tests 馃槙Luckily we've been working on our test setup, so I'll make sure to add a test, so we don't break this behaviour again.
Thanks again for reporting! Will add a mention in the PR 馃憤
Uff I have the same problem any fix of this issue?
For now the only workaround is destroying draggable, adding/removing a container and re-initializing:
draggable.destroy();
/* Code that adds or removes a container to the dom */
new Draggable(newContainers, {
// same options as before
})
Sorry about this, we'll make sure to add tests when we fix this, so it doesn't happen again!
I'll keep you posted
This is now available with the new beta.6 release. Closing this, but feel free to re-open if things don't work as expected