Can''t seem to get the onUpdate to work in for a sortable list. I am following the documentation and the included functional tests but nothing is firing for me. Any idea why? Sortable.create(''list1'', { tree:true , onUpdate:function(sortable){ alert(''onUpdate'') } , handle: ''handle'' , scroll:window , only:''drag'' }); I''m running Prototype 1.5.1.1 and Scriptaculous 1.7.1_beta3 --~--~---------~--~----~------------~-------~--~----~ 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 had the same problem, and the issue is probably in your markup. Each item of the ''sortable'' has to be named in the format ''string_integer''. So this will work: <ul id="makeMeSortable"> <li id="item_1"></li> <li id="item_2"></li> <li id="item_3"></li> </ul> and this will NOT work: <ul id="makeMeSortable"> <li id="firstitem"></li> <li id="seconditem"></li> <li id="thirditem"></li> </ul> The items will still drag if they are not properly id''ed, but the onUpdate and onChange events will not fire. This drove me crazy for 3 days. I hope I can save you a similar headache. -Chris c h r i s AT u n t r o d DOT c o m On Nov 2, 10:18 am, Louis W <louis.wa...-Rl5vdzG4YPxnqUr/ghgNOUEOCMrvLtNR@public.gmane.org> wrote:> Can''t seem to get the onUpdate to work in for a sortable list. I am > following the documentation and the included functional tests but > nothing is firing for me. Any idea why? > > Sortable.create(''list1'', { > tree:true > , onUpdate:function(sortable){ > alert(''onUpdate'') > } > , handle: ''handle'' > , scroll:window > , only:''drag'' > }); > > I''m running Prototype 1.5.1.1 and Scriptaculous 1.7.1_beta3--~--~---------~--~----~------------~-------~--~----~ 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 can easily customize this by resetting (in your own js file) the Sortable.SERIALIZE_RULE to something else than /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/ Regards, Tobie On Nov 16, 2:04 pm, Chris <numloc...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I had the same problem, and the issue is probably in your markup. Each > item of the ''sortable'' has to be named in the format ''string_integer''. > So this will work: > > <ul id="makeMeSortable"> > <li id="item_1"></li> > <li id="item_2"></li> > <li id="item_3"></li> > </ul> > > and this will NOT work: > > <ul id="makeMeSortable"> > <li id="firstitem"></li> > <li id="seconditem"></li> > <li id="thirditem"></li> > </ul> > > The items will still drag if they are not properly id''ed, but the > onUpdate and onChange events will not fire. > > This drove me crazy for 3 days. I hope I can save you a similar > headache. > > -Chris > > c h r i s AT u n t r o d DOT c o m > > On Nov 2, 10:18 am, Louis W <louis.wa...-Rl5vdzG4YPxnqUr/ghgNOUEOCMrvLtNR@public.gmane.org> wrote:> Can''t seem to get the onUpdate to work in for a sortable list. I am > > following the documentation and the included functional tests but > > nothing is firing for me. Any idea why? > > > Sortable.create(''list1'', { > > tree:true > > , onUpdate:function(sortable){ > > alert(''onUpdate'') > > } > > , handle: ''handle'' > > , scroll:window > > , only:''drag'' > > }); > > > I''m running Prototype 1.5.1.1 and Scriptaculous 1.7.1_beta3--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Another thing which I just discovered is that, the element needs to have an id. So, if you try to make below ul sortable, it won''t work. Sortable.options function is going to boomerang. Can''t think of a neat solution to fix this, till then it is something to be careful about. <ul > <li id="item_1"></li> <li id="item_2"></li> <li id="item_3"></li> </ul> -Surendra On Nov 16, 2007 6:34 PM, Chris <numlocked-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I had the same problem, and the issue is probably in your markup. Each > item of the ''sortable'' has to be named in the format ''string_integer''. > So this will work: > > <ul id="makeMeSortable"> > <li id="item_1"></li> > <li id="item_2"></li> > <li id="item_3"></li> > </ul> > > and this will NOT work: > > <ul id="makeMeSortable"> > <li id="firstitem"></li> > <li id="seconditem"></li> > <li id="thirditem"></li> > </ul> > > The items will still drag if they are not properly id''ed, but the > onUpdate and onChange events will not fire. > > This drove me crazy for 3 days. I hope I can save you a similar > headache. > > -Chris > > c h r i s AT u n t r o d DOT c o m > > > On Nov 2, 10:18 am, Louis W <louis.wa...-Rl5vdzG4YPxnqUr/ghgNOUEOCMrvLtNR@public.gmane.org> wrote: > > Can''t seem to get the onUpdate to work in for a sortable list. I am > > following the documentation and the included functional tests but > > nothing is firing for me. Any idea why? > > > > Sortable.create(''list1'', { > > tree:true > > , onUpdate:function(sortable){ > > alert(''onUpdate'') > > } > > , handle: ''handle'' > > , scroll:window > > , only:''drag'' > > }); > > > > I''m running Prototype 1.5.1.1 and Scriptaculous 1.7.1_beta3 > > >-- Surendra Singhi http://ssinghi.kreeti.com, http://www.kreeti.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---