Hello, Is there a way to make a sortable aware of new items, without destroying and recreating the sortable ? Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Afaik, no. There might have been some patches submitted to the trunk to fix this, but in the current release, there''s nothing. I just finished dealing with this myself. On 10/17/06, Andrei <jules.verne-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, > > Is there a way to make a sortable aware of new items, without > destroying and recreating the sortable ? > > Thanks > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hey Andrei, Andrei a écrit :> Is there a way to make a sortable aware of new items, without > destroying and recreating the sortable ?Not that I know of, and the source code, er... concurs :-) Actually, manually going into the details of registering stuff with sortable would: - create a coupling to undocumented, mostly internal, workings. This could very well mean code break down the road, as spinoffs code is a bit volatile - end up with such a minor improvement in performance, if any, that it would prove pretty useless. BESIDES, you DO need to unregister all internal droppables when you''re about to replace the list. It''s a mandatory requirement when using draggables/droppables: if you remove such elements from the DOM, unregister them first. Sortable.destroy takes proper care of that for you. -- Christophe Porteneuve a.k.a. TDD "[They] did not know it was impossible, so they did it." --Mark Twain Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
About the coupling: That shouldn''t be a problem as the javascripts are shipped with the application, so I am in control of what libraries the user uses, and I will thoroughly test new js libraries before using them in the application. About the performance: I don''t think it will be minor; creating a sortable with 80 items already makes the browser hang for a while so anything that prevents that from happening more than once is welcome (especially since my lists may have hundreds of items). Regards, Andrei Christophe Porteneuve wrote:> Hey Andrei, > > Andrei a écrit : > > Is there a way to make a sortable aware of new items, without > > destroying and recreating the sortable ? > > Not that I know of, and the source code, er... concurs :-) > > Actually, manually going into the details of registering stuff with > sortable would: > > - create a coupling to undocumented, mostly internal, workings. This > could very well mean code break down the road, as spinoffs code is a bit > volatile > > - end up with such a minor improvement in performance, if any, that it > would prove pretty useless. > > BESIDES, you DO need to unregister all internal droppables when you''re > about to replace the list. It''s a mandatory requirement when using > draggables/droppables: if you remove such elements from the DOM, > unregister them first. Sortable.destroy takes proper care of that for you. > > -- > Christophe Porteneuve a.k.a. TDD > "[They] did not know it was impossible, so they did it." --Mark Twain > Email: tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi there, The sortables represent a very, very generic and flexible way to easily add "sortable" behaviour to a list of elements. It''s not optimized for performance with huge numbers of items, so you probably need to investigate a solution that''s more specifically optimized for your needs. For example, if the document isn''t changing (like new nodes added or positioning changes) while dragging and reodering occurs, you easily improve performance by caching the positions of the sortable items in your code (this will probably provide more than enough extra responsiveness). If someone is up to it, such a behaviour could probably made into sortables/draggables with some kind of option. Best, Thomas Am 18.10.2006 um 17:57 schrieb Andrei:> About the performance: > > I don''t think it will be minor; creating a sortable with 80 items > already makes the browser hang for a while so anything that prevents > that from happening more than once is welcome (especially since my > lists may have hundreds of items). > > Regards, > Andrei >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---