A customer has a project using SortableJS but not to move between lists, instead, it is been used to select a given item from a list, and "drop it" into a given hyperlink. We need to be able to detect the drop event, but prevent any modifications to the DOM, since we only need the data, we also need to prevent cloning.
This is what we have so far
Source configuraton:
new Sortable(cardsContainer, {
animation: 200,
ghostClass: 'dragging',
sort: false,
forceFallback: true,
group: {
name: 'shared',
pull: true, // To clone: set pull to 'clone',
revertClone: true
},
onStart: function (evt) {
createDropSortable();
menuWrapper = document.querySelector('.sidebar-menu');
observer.observe(menuWrapper, { attributes: true, childList: true, subtree: true });
}
});
Dest configuration ( anchor/link ):
document.querySelectorAll('.drop-box').forEach(dropBox => {
new Sortable(dropBox, {
group: {
name: 'shared'
},
ghostClass: "dropping",
animation: 200,
sort: false,
filter: '.drop-box',
onAdd: function (evt) {
},
});
})
Any ideas what we can do?
Thanks for the help.
Aucun commentaire:
Enregistrer un commentaire