Hi, I''m using the rails sortable_element helper on a list and after it has been sorted I have used this code: page[''page_'' + p.id.to_s].replace :partial => ''page'', :locals => { :page => p } to replace the list items that changed order as the html has to change. The problem is that any of the list items that are ''replaced'' are now not sortable. Is this expected behavior and is there a fix or a workaround? thanks, DAZ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''ve found a bit of a hack solution. If I change replace to replace_html, it works. I guess that this is because the id is in the <li> and if I use replace_html, the original <li> stays there. The problem with this approach is that the generated html is a bit rubbish - there will be a nested <li> inside the original <li> and they will both have the same id. Is this acceptable or is there a better/correct way of doing this? cheers, DAZ On Jun 11, 1:42 pm, DAZ <daz4...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I''m using the rails sortable_element helper on a list and after it has > been sorted I have used this code: > page[''page_'' + p.id.to_s].replace :partial => ''page'', :locals => > { :page => p } > > to replace the list items that changed order as the html has to > change. > > The problem is that any of the list items that are ''replaced'' are now > not sortable. Is this expected behavior and is there a fix or a > workaround? > > thanks, > > DAZ--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
my ''hack'' doesn''t work too well, as it introduces loads of problems if you then try to sort again as the array that is sent to the sort action gets messed up.....oh well, it seems that you can''t seem to do any JS tricks with generated content. DAZ On Jun 11, 6:53 pm, DAZ <daz4...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''ve found a bit of a hack solution. > > If I change replace to replace_html, it works. I guess that this is > because the id is in the <li> and if I use replace_html, the original > <li> stays there. The problem with this approach is that the generated > html is a bit rubbish - there will be a nested <li> inside the > original <li> and they will both have the same id. > > Is this acceptable or is there a better/correct way of doing this? > > cheers, > > DAZ > > On Jun 11, 1:42 pm, DAZ <daz4...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, > > > I''m using the rails sortable_element helper on a list and after it has > > been sorted I have used this code: > > page[''page_'' + p.id.to_s].replace :partial => ''page'', :locals => > > { :page => p } > > > to replace the list items that changed order as the html has to > > change. > > > The problem is that any of the list items that are ''replaced'' are now > > not sortable. Is this expected behavior and is there a fix or a > > workaround? > > > thanks, > > > DAZ--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi DAZ, DAZ wrote:> my ''hack'' doesn''t work too well, as it introduces loads > of problems if you then try to sort again as the array that > is sent to the sort action gets messed up.....oh well, it > seems that you can''t seem to do any JS tricks with > generated content.Have you tried just doing a replace_html on the <ol> or <ul> surrounding your <li>s? I''ve just been fighting with something that may be related. Haven had enough time to isolate the problem further, but when I render a partial with an observe_field in it ''normally, the <script> shows up in FireBug. When I render the same partial via RJS, it disappears. The actions still fire, but I lose the debug ability I so_much rely on with FireBug. HTH, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---