I am having trouble with scriptaculous'' drag & drop here. I have a div that''s droppable, and two divs contained within that first div, each of which are also droppable. The containing (outer) div seems to grab all drops. Even though I defined the inner ones as "greedy" which is supposed to mean that draggables don''t propagate through. I read elsewhere that when a nested div and its containing div are both droppable, the one that was made droppable *earliest* actually grabs any drop, regardless of the "greedy" option. Is this true? If so, that would seem to contradict the intent and purpose of that option. In my situation, I really need the inner div to receive anything dropped on it. I do not want the drop to propagate to the outer div. But I cannot make the inner div droppable before the outer one, because the inner div does not even exist until the user drops something on the outer div. Only after that happens is the inner div created and made droppable. So is there no way to make this inner div droppable in the way I wish with scriptaculous? I have read one or two people asking this same question, getting no reply (or just a suggestion to create their droppables in reverse order) and apparently giving up. I thought the ''greedy'' option would do what I''m trying to do, but apparently it does not. I even tried Droppables.remove(''outer_div'') after the inner div is made droppable, but that failed. The outer div remained droppable and continued to steal every drop that occurs over the inner div location. I would be grateful for any insight and help on this. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
No answer to this topic. I search through the archives and I see repeats of the same question by other posters, also without much response. The issue sits in plain sight at the bottom of the relevant page in the (broken) scriptaculous wiki with no answer for 2 years. In my opinion scriptaculous'' drag-n-drop functionality is *broken* if it is only able to hit test the candidate target divs in the same order as they were registered, without the ability to specify the reverse order or to specify bubbling and/or capture options at the time of registering. Does everyone just skip scriptaculous'' drag-n-drop if they''re dealing with nested droppables, and work directly in plain javascript/DOM methods instead? Or use another library? Prototype does not have its own drag-n-drop functions though it does help out a lot in event registration in general. I don''t want to have to start over in JQuery or even Ext to get this working in my project. I''m just surprised that with scriptaculous included in Rails (and also in Pylons, the similar Python framework) no one has a fix for this in common. The answers I''ve gotten on IRC are basically "screw scriptaculous, get a different library, or learn to produce what you want in plain javascript." I''m willing to do that, just don''t want to miss any obvious short cut. On Mar 22, 7:02 pm, Eric Ongerth <ericonge...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am having trouble with scriptaculous'' drag & drop here. I have a div > that''s droppable, and two divs contained within that first div, each > of which are also droppable. The containing (outer) div seems to grab > all drops. Even though I defined the inner ones as "greedy" which is > supposed to mean that draggables don''t propagate through. > > I read elsewhere that when anesteddiv and its containing div are > both droppable, the one that was made droppable *earliest* actually > grabs any drop, regardless of the "greedy" option. Is this true? If > so, that would seem to contradict the intent and purpose of that > option. > > In my situation, I really need the inner div to receive anything > dropped on it. I do not want the drop to propagate to the outer div. > But I cannot make the inner div droppable before the outer one, > because the inner div does not even exist until the user drops > something on the outer div. Only after that happens is the inner div > created and made droppable. > > So is there no way to make this inner div droppable in the way I wish > with scriptaculous? I have read one or two people asking this same > question, getting no reply (or just a suggestion to create theirdroppablesin reverse order) and apparently giving up. > > I thought the ''greedy'' option would do what I''m trying to do, but > apparently it does not. I even triedDroppables.remove(''outer_div'') > after the inner div is made droppable, but that failed. The outer div > remained droppable and continued to steal every drop that occurs over > the inner div location. > > I would be grateful for any insight and help on this.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I''ve never done too much with droppables, other than for re-ordering simple lists. What is the use-case for a droppable target with more droppable targets inside? -justin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 18, 10:21 pm, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve never done too much with droppables, other than for re-ordering > simple lists. > > What is the use-case for a droppable target with more droppable targets inside?The user populates an equipment reservation form by dragging available items from a "search results" area over to a "reservation" area. In my particular case, the user needs to be able to create subgroups of items within the reservation that they are creating, and then to be able to drag items specifically into one or another of those groups. (In fact, it''s one level more complicated -- a reservation contains one or more sets which each can contain 1 or more packages, each package comprising one or more items... but for the sake of discussion it''s enough to only consider the first level of nesting and know that it is necessary for this scenario). The number of subgroups ("sets") in a reservation is unknown/undecided ahead of time, so they cannot be preloaded. They must be created on client time. When the user drops a first item onto the reservation div, the first set is created to contain it. After that point, the user may either drag their next item onto that set, thus adding to its contents, or onto the reservation itself again, in which case their intention is taken to be creating another set and populating it. Of course after there are multiple sets present in the reservation, they then have the choice of dropping items into any of the existing sets (or the reservation again, once more adding another set). As scriptaculous'' drag-drop functionality now stands, unless I am misinterpreting the situation: my nested divs (sets and packages) will have all of their drops captured by the reservation div containing them, though the call to Droppables.add() gave me no choice in the matter. This leaves me two options for providing the abilities described above. (1.) Delegation: this is what I''m currently doing. Only the reservation div is a drop target so there''s no nesting problem. When an item is dropped somewhere within the reservation''s area, we build an array including the reservation itself and all existing sets and packages within it, then for each div in this array get its position and size and hit-test it against the drop location. Fine, this is on client time and it''s reasonably fast, but it''s dumb. I should be able to simply make each set and package a drop target, and have the drop event get passed a reference to the *lowest* containing div into which it is dropped. Not the highest. Where is highest-first useful, unless the programmer specifically requests event capture? (2.) Alternative: Instead, let''s say at first there''s only the reservation drop target. Then when an item is dropped onto it, the reservation is removed from Droppables, the new "set" div is created within the reservation and the set div is made droppable, and finally the reservation div is once again made droppable, in order to get the hit-test order right. Same analysis as above... having to do this is not the end of the world, but it shouldn''t be necessary. Is there an expected release date for the next scriptaculous version? Or when the wiki will be fixed? I wouldn''t mind donating some time to get the drag and drop functions to work in this more general case by adding working parameters for bubbling and capturing (see W3C DOM level 2 events specs). But right now it''s somewhat difficult to even tell what''s going on with the project. Finally, I may just be barking up the wrong tree, and I would be happy to hear that or take any other advice offered. - Eric --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---