Jim Jones
2006-Jan-05 10:21 UTC
[Rails] sortable_element not recognizing newly added <li> elements
I have a user defined list of items. Using the sortable_element function, I can manipulate the ordering of this list fine by dragging each component around. When I dynamically add another <li> item to this list, the newly added item is _not_ "draggable" like its other siblings. Using the sortable_element function, how do I make it aware of newly added list items? Here is my current sortable_element definition. <%= sortable_element dow + ''orderList'', :complete => visual_effect(:highlight, "status", :duration => 0.5 ), :url => { :action => ''updateOrder'', :dow => dow } %> TIA. Jim -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060105/f848a881/attachment.html
Jim Jones
2006-Jan-05 20:01 UTC
[Rails] Re: sortable_element not recognizing newly added <li> elemen
Jim Jones wrote:> I have a user defined list of items. Using the sortable_element > function, I can manipulate the ordering of this list fine by dragging > each component around. > > When I dynamically add another <li> item to this list, the newly added > item is _not_ "draggable" like its other siblings. > > Using the sortable_element function, how do I make it aware of newly > added list items? Here is my current sortable_element definition. > > <%= sortable_element dow + ''orderList'', > :complete => visual_effect(:highlight, "status", :duration => > 0.5 ), > :url => { :action => ''updateOrder'', :dow => dow } %> > > TIA. > > > JimFound a solution to my problem. Looks like I need to recreate the sortable_element each time a new <li> item is added. Here''s a description of the problem. http://dev.rousette.org.uk/ticket/136 And here''s a source exemplifying the solution. http://dev.rousette.org.uk/file/trunk/tracks/app/views/context/list.rhtml You want to call the Sortable.create method within the :OnComplete callback. Jim -- Posted via http://www.ruby-forum.com/.