Is there a way to programmatically drag and drop? (Without the mouse drag event)
Here is my fiddle : https://jsfiddle.net/a9rkz2pg/
The blocks in the widgets group can be dragged using the mouse drag event, as a clone and dropped into Group 1 or Group 2,3,4.. (appears on click of plus button)
But, is there a way this can be done programmatically, either by knowing the id/class of the draggable or it’s text content?
new Sortable($('#widgets-1')[0], {
group: {
name: 'letters',
put: false,
pull: 'clone',
},
setData: function(dataTransfer, element) {
dataTransfer.setData('text', element.textContent);
},
sort: false
});
Any help would be much appreciated. Thank you!
This would be such a useful feature! I am currently working on something where we need to programmatically set the order back to a pre-defined order (or the page load order) if someone clicks a "reset" button. Still trying...
Any luck?
This is exactly what I was looking for, but don't see any way.
edit: updated link Hi, I'm working on the ember addon and came up with this https://github.com/SortableJS/ember-sortablejs/blob/master/addon-test-support/dndsimulator.js
It should help.
@lvegerano hey be honest, did you decompiled Hogwarts "Wingardium Leviosa" spell? Because it feels like it!!
P.S. this is going to help a lot in best open-source task manager called Vikunja. If this brutal Dark Magic will get approved of couse 😆
Also be careful with elements seletion folks, that code calculates distance between centers of source & target elements.