Hi all, I have 3 lists containing users (users and groups). You can move the users between the lists. The user are ordered alphabetically in the list. I know it is possible to move the users between the lists but is it also possible that when you drop a user in a list it get placed in the correct alphabetical place? Eg: Group 1 - Jan - Tom <-- drag Group 2 - Kevin - Nina Dragging Tom to group 2 Group 1 - Jan Group 2 - Kevin - Nina - Tom Regards, Stijn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yes. Use sortable.sequence to get the order of the ids. (this is probably a string, so convert it to an array with split or similar). Then use $(array) to find the elements (i think you can do this). Then pluck/use select to get the value you want to sort. (this should be an array) Now you need to get a hash id-name, so you''ll probably want to do something fancy with hashes so you end up with pairs. Now sort the hash (again I think there''s a method)... now extract the ids back from your sorted hash and use sortable.sort to set the order of the elements... Well.. thats a rundown of what i''d try first. Read api docs and compromise/mix match methods as you see fit. Gareth On 8/1/07, Tarscher <tarscher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hi all, > > I have 3 lists containing users (users and groups). You can move the > users between the lists. The user are ordered alphabetically in the > list. > > I know it is possible to move the users between the lists but is it > also possible that when you drop a user in a list it get placed in the > correct alphabetical place? > > Eg: > > Group 1 > - Jan > - Tom <-- drag > Group 2 > - Kevin > - Nina > > Dragging Tom to group 2 > > Group 1 > - Jan > Group 2 > - Kevin > - Nina > - Tom > > Regards, > Stijn > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You''ll also want to use a Sortable Observer (peek in dragdrop.js for an example), or the onEnd callback. Observer callback signature: onEnd: function (eventName, draggable, event) onEnd option callback signature: onEnd: function (draggable, event) TAG On Aug 1, 2007, at 6:41 AM, Gareth Evans wrote:> Yes. > > Use sortable.sequence to get the order of the ids. (this is > probably a string, so convert it to an array with split or similar). > Then use $(array) to find the elements (i think you can do this). > Then pluck/use select to get the value you want to sort. (this > should be an array) > Now you need to get a hash id-name, so you''ll probably want to do > something fancy with hashes so you end up with pairs. > Now sort the hash (again I think there''s a method)... > now extract the ids back from your sorted hash and use > sortable.sort to set the order of the elements... > > Well.. thats a rundown of what i''d try first. > Read api docs and compromise/mix match methods as you see fit. > > Gareth > > > > On 8/1/07, Tarscher <tarscher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi all, > > I have 3 lists containing users (users and groups). You can move the > users between the lists. The user are ordered alphabetically in the > list. > > I know it is possible to move the users between the lists but is it > also possible that when you drop a user in a list it get placed in the > correct alphabetical place? > > Eg: > > Group 1 > - Jan > - Tom <-- drag > Group 2 > - Kevin > - Nina > > Dragging Tom to group 2 > > Group 1 > - Jan > Group 2 > - Kevin > - Nina > - Tom > > Regards, > Stijn > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---