You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to exclude an item from being draggable works but not from being sortable -- the problem is that other elements can be placed behind it.
Here's the expected behavior using jQuery UI: http://jsfiddle.net/mirohristov/gn3r2ax4/ Notice that you can never place an item after the last "Add New Item". This is another example using jQuery UI that makes distinction between sortable and drop target and can disable it either one.
I don't want to take the "Add New Item" out of the sortable div.
Any idea how to accomplish this?
Thanks!
The text was updated successfully, but these errors were encountered:
miro-ux
changed the title
[feature] Can't exclude item from being sortable and drop target
[bug] Can't exclude item from being sortable and drop target
Mar 12, 2021
A class .exclude is added to the desired element then a combination of filter and onMove
let mySortable = $(".sortable").sortable({
filter: ".exclude", //Excludes element - similar to `:not()`
onMove: function(evt) {
return evt.related.className.indexOf('exclude') === -1; // returns false when the .exclude is about to be moved
}
});
Note: I do feel like this should be the default behavior for filtered items
Trying to exclude an item from being draggable works but not from being sortable -- the problem is that other elements can be placed behind it.
Here's the expected behavior using jQuery UI:
http://jsfiddle.net/mirohristov/gn3r2ax4/
Notice that you can never place an item after the last "Add New Item".
This is another example using jQuery UI that makes distinction between sortable and drop target and can disable it either one.
What I've tried so far:
http://jsfiddle.net/mirohristov/69bfknzg/
Notice that you can drag another element behind the "Add New Item"
Following comments in this issue I've tried to use onMove to no avail:
I don't want to take the "Add New Item" out of the sortable div.
Any idea how to accomplish this?
Thanks!
The text was updated successfully, but these errors were encountered: