Hi, Override or patch the way Sortable works. I want the ability to limit the number of items allowed in a Sortable? What would be the best way to go about it? The onHover event for example inside Sortable only fires for sortables where I can drop my draggable - is there a way for me to prevent this (or other events) from firing under certain conditions? Thanks Joerg --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
this is just a guess but maybe in the onDrop section count the number of items in the sortable? // from the shopping cart demo Droppables.add(''blah'', { accept: ''whatever'', onDrop: function(element) { /* put your counting code here if the count is >= var max then reject the dropable else add it*/}); On 9/3/07, Joerg <senor.j.onion-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi, > > Override or patch the way Sortable works. I want the ability to limit > the number of items allowed in a Sortable? What would be the best way > to go about it? > > The onHover event for example inside Sortable only fires for sortables > where I can drop my draggable - is there a way for me to prevent this > (or other events) from firing under certain conditions? > > Thanks > Joerg > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 - I don''t even want the sortable to accept any more items if it is ''full''. You know how you can limit the type of items with ''accepts'' for example? If an item hasn''t got a particular classname, the sortable doesn''t even receive an onHover event .... so I want to - on that level (overriding some script.aculo.us methods) - limit the number of items like that. So, can anybody give me a hint which methods I need to look at it inside the dragdrop.js file? Thanks Joerg On Sep 3, 6:49 pm, "Brian Williams" <brianw1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> this is just a guess but maybe in the onDrop section count the number of > items in the sortable? > > // from the shopping cart demo > Droppables.add(''blah'', { > accept: ''whatever'', > onDrop: function(element) > { /* put your counting code here if the count is >= var max then > reject the dropable else add it*/}); > > On 9/3/07, Joerg <senor.j.on...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi, > > > Override or patch the way Sortable works. I want the ability to limit > > the number of items allowed in a Sortable? What would be the best way > > to go about it? > > > The onHover event for example inside Sortable only fires for sortables > > where I can drop my draggable - is there a way for me to prevent this > > (or other events) from firing under certain conditions? > > > Thanks > > Joerg--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---