Opened 10 years ago

Last modified 6 years ago

#3874 open feature

Restrict certain drops by pre-defined rule or callback

Reported by: javaJake Owned by:
Priority: minor Milestone: 2.0.0
Component: ui.sortable Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:

Description

I've tried to transition over from NestedSortables to Sortable in jQuery UI, since NestedSortables depends on deprecated jQuery functionality. However, I have been unable to adapt my code in a simple, clean fashion to Sortable.

Here's my scenario: I currently have two lists: categories and links. Categories may only contain links, and links may not contain anything at all. Now, the "links may not contain anything" rule is easy to implement - merely make sure that all links are list items, and not lists, and Sortable will not try to nest anything beneath it. However, categories, because they are lists, may contain anything you throw at them.

I would like to be able to tell Sortable which lists are able to contain which items. If you wanted to allow for an even wilder set of rules (such as seen here: <http://markmail.org/message/63qx5pvptvnrzdcm>) you could instead listen to the return value of any callbacks assigned via .sortable({}) to decide whether or not to cancel the sort, or do some other action.

Change History (3)

comment:1 Changed 10 years ago by Jörn Zaefferer

Milestone: TBD1.next

comment:2 Changed 6 years ago by Scott González

Milestone: 1.next2.0.0

comment:3 Changed 6 years ago by Jörn Zaefferer

Status: newopen

Consider for redesign. Accept/restrict should be easy to customize with a callback.

Note: See TracTickets for help on using tickets.