I have a Sortable that''s working like a charm, but now I would like to be able to drop objects from that Sortable onto a Droppable that''s not part of my Sortable. I just did a small test page where it didn''t work, so my first question has to be "is this supposed to work?", before I dig too deep into it. "accept" for the droppable is set to the appropriate id for the sortable, but maybe i''ve missed something else.
> I have a Sortable that''s working like a charm, but now I would like to > be able to drop objects from that Sortable onto a Droppable that''s not > part of my Sortable. > > I just did a small test page where it didn''t work, so my first question > has to be "is this supposed to work?", before I dig too deep into it.Seems like it''s not supposed to work, since there is a check if the droptargets parent is a Sortable. Maybe a future enhancement? I could obtain my desired effect my making my droptarget another Sortable, with an onUpdate that simply removes the dropped element (after an ajax call has been made). A problem here was that I couldnt find a way to obtain the element that had been dropped? I did a dirty fix to get around that, but I believe that info should be accessible. A suggestion for the reference pages, it should mention that the ID needs to be in the format <string>_<string> for serialization to work. This library really rocks, hope to be able to contribute to it later!
On 25/07/05, Ulf Hedlund <spamtrap@slideware.com> wrote:> I could obtain my desired effect my making my droptarget another > Sortable, with an onUpdate that simply removes the dropped element > (after an ajax call has been made). A problem here was that I couldnt > find a way to obtain the element that had been dropped? I did a dirty > fix to get around that, but I believe that info should be accessible.The info does get passed from the Draggable, but the Observer doesn''t use it. I say this is an omission. Changing SortableObserver.onEnd to onEnd: function(draggable) { if(this.lastValue != Sortable.serialize(this.element)) this.observer(this.element, draggable) } works just fine with onUpdate: function(list, draggable){alert(list + ": " + draggable.element)}> A suggestion for the reference pages, it should mention that the ID > needs to be in the format <string>_<string> for serialization to work.I agree. It should also mention that the first string is discarded in the serialization. Personally, I just removed the split on "_" and pass the ID as is. Bye, Martin
Ulf Hedlund wrote:>>I have a Sortable that''s working like a charm, but now I would like to >>be able to drop objects from that Sortable onto a Droppable that''s not >>part of my Sortable. >> > > Seems like it''s not supposed to workI''ll correct myself here, it does work. The only thing needed was to specify a hoverclass for the droppable. Then I added a "remove" method on the sortable to be able to remove the dropped object. This library is a real timesaver! Now I''m trying to add support for the ctrl-key to make it possible to "copy" the object if ctrl is pressed or "move" if not. Thomas, is there an official way to submit additions?
* Ulf Hedlund <spamtrap@slideware.com> [Jul 27. 2005 11:20]:> Ulf Hedlund wrote: > >>I have a Sortable that''s working like a charm, but now I would like to > >>be able to drop objects from that Sortable onto a Droppable that''s not > >>part of my Sortable. > >> > > > > Seems like it''s not supposed to work > > I''ll correct myself here, it does work. The only thing needed was to > specify a hoverclass for the droppable.I just made a similar experience yesterday but I couldn''t find it properly documented anywhere. :-( Klaus
Am 27.07.2005 um 11:19 schrieb Ulf Hedlund:> I''ll correct myself here, it does work. The only thing needed was to > specify a hoverclass for the droppable. Then I added a "remove" > method > on the sortable to be able to remove the dropped object.Yeah, that''s a bug. Fixed in the latest SVN trunk.> Now I''m trying to add support for the ctrl-key to make it possible to > "copy" the object if ctrl is pressed or "move" if not. > Thomas, is there an official way to submit additions?Sure. make a patch against the SVN trunk and submit it on the Rails trac (dev.rubyonrails.org). Follow the rules there, e.g. [PATCH] Blabla and set the owner to thomas@fesch.at. Thomas