I use this code to initialize dragula when the page loads. After I modify my view with dragging and dropping a small container into another container, the small container does not have the functionality I specified in my dragula. Only after refreshing the webpage, the small container functionality is normal. How should I make my dragula work fine after modifying the view without the need to refresh the webpage?
<pre>
var drake = dragula(querySelectorAllArray('.Container'), {
copy: function(el, source) {
......
}
</pre>
You can set the dragula object as a global variable, and then destroy and rebind dragula after you have updated your view / container.
var drake = window.dragula();
function setupDragula(){
drake.destroy();
drake = dragula([leftContainer, rightContainer]);
}
©2020 All rights reserved.