Hi guys i have also been looking into the tree function and its
I'm interested in seeing Eric's solution as well.
How would i go about limiting the level of nests to a set amount. So
if a item contains items it cannot be drop onto another item as it
would go over the set amount.
Is this even possible?
A real world example would be imagine a cms that has a set pages and
sub pages and a page can only have one level of sub pages.
On Jan 27, 9:26 am, Cyrus <arianglan...@googlemail.com> wrote:
> Hey guys,
> sorry for messing up your thread, but obviously you are using the
> sortable tree: Have you experienced the same problems? (You can answer
> in this
> On 26 Jan., 22:12, Stephen <sgruenh...@ihouseweb.com> wrote:
> > Eric,
> > I'm interested in seeing your solution. I have the same problem of
> > trying to prevent the nested sortables from accepting groups.
> > Stephen
> > On Jan 7, 3:35 pm, Eric <eylin2...@gmail.com> wrote:
> > > I ended up extending Scriptaculous to allow for this behavior. The
> > > changes in the new API are:
> > > 1. Added a "groupAccept" option toSortable. It takes the same
> > > argument as Droppables' accept, but is used to limit whatgroupsin
> > > aSortabletreewill accept. (Group is defined as any element in
> > > theSortablelist that contains a nested list). For the example in my
> > > previous post, I gave all Items a class name like "item", and set
> > > groupAccept to "item". This ensures only Items can be dropped
> > > intoGroups,Groupscannot be dropped intoGroups.
> > > 2. To support the implementation of #1, I added an option to
> > > Droppables called "acceptIf". acceptIf takes a function that takes
> > > two arguments: the dragged element and the Droppable object. acceptIf
> > > should return true if the drop should occur and false otherwise. This
> > > is meant to be a more general and dynamic way of specifying what can
> > > be dropped than the existing "accept" and "containment" options.
> > > If some of you are interested in these enhancements, I can post the
> > > code here.
> > > How do I go about adding these enhancements to the Scriptaculous
> > > trunk?
> > > Eric
> > > On Jan 6, 10:31 pm, Eric <eylin2...@gmail.com> wrote:
> > > > I am usingSortablewithtreeenabled on a list like below:
> > > > Group 1
> > > > Item 1
> > > > Item 2
> > > > Item 3
> > > > Group 2
> > > > Item 4
> > > > Here, bothGroupsand Items can be dragged. Additionally, Items can
> > > > be dragged intoGroups(each Group contain an UL). However, I want to
> > > > preventGroupsfrom being dragged intoGroups, but there doesn't seem
> > > > to be an option inSortableto achieve that.
> > > > The solution would be something like being able to specify "accept"
> > > > class names for theSortabletree'snested ULs, so only Items would be
> > > > allowed insideGroups. But that doesn't seem to be possible. Is
> > > > there something that I am missing, or would doing this require me to
> > > > extendSortable'simplementation myself?
> > > > Thanks,
> > > > Eric
> > > > ----------------
> > > > By the way, in the course of implementing my drag-and-droptree, I
> > > > found thetree-dump output ofSortabletreeto be clumsy to use on the
> > > > server side, because it would require me to recreate thetreein the
> > > > database each time. Instead, I added a Draggables observer for the
> > > > onEnd event to capture each sorting action, and send to the server
> > > > only the change that was made: what element was dragged, which
> > > > container it was dragged to and at what position. This required a bit
> > > > of additional coding to determine the location and position of dragged
> > > > element, but made the server side code simpler and faster. I am just
> > > > curious, have other people done the same?
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to firstname.lastname@example.org
To unsubscribe from this group, send email to
For more options, visit this group at