I want to destroy my Sortable.js elements.
Initialization:
('Item' is object which contains my sortable elements)
I need to initialize multiple sets at once, so I'm storing it into an array
SortableTiles[index] = Sortable.create(item, {
animation: 150,
swapThreshold: 1,
});
This works just fine, but I'm unable to destroy them. In Web console i tried for test
SortableTiles[0].sortable('destroy') - Uncaught TypeError: SortableTiles[0].sortable is not a function
and variants of this, but all with the same result.
Sortable.js
has the method destroy
on sortable
class instance, so you can call it on that directly:
SortableTiles[0].destroy()