sortable('.o-sortable', {
forcePlaceholderSize: true,
placeholderClass: 'ph-class',
hoverClass: 'bg-maroon yellow',
});
sortable('.o-sortable', {
// options
});
sortable('.o-sortable', {
items: ':not(.disabled)'
});
Connected: This means an item can be dragged into another (connected) list.
Handles: Elements, e.g. || an item can be dragged with.
// white & orange items
sortable('.o-sortable', {
connectWith: 'js-connected'
});
// blue items
sortable('.o-sortable-inner', {
connectWith: 'js-inner-connected'
});
// disabled / enable list
sortable('.o-sortable', 'disable');
sortable('.o-sortable', 'enable');
// reload list after adding items
sortable('.o-sortable', 'reload');
tbody and setting the items
property to tr.
| Food | Topping | Absolutely No |
| Taco | Salsa | Pickles |
| Burger | Lettuce | Rice |
| Pad Thai | Crushed Red Pepper | Spaghetti Noodles |
| Bratwurst | Sourkraut | Jelly |
| Simple | Simple | Simple |
| Table | Table | Table |
| Bratwurst | Bratwurst | Bratwurst |
acceptFrom allows to control which sortable to accept drops from.
Item 1-6 are allows to be sorted with Item 7-12 but not the other way around.
sortable('.o-sortable1', {
acceptFrom: false (accept from no one)
});
sortable('.o-sortable2', {
acceptFrom: '.o-sortable1' (accept from .o-sortable1)
});
sortable('.o-sortable', {
copy:true // default to false
maxItems: 2
});