[Proto-Scripty] sortable tree in rails
Hi, I'm a new member to this group, and would appreciate some help with using Sortable in Rails. How do I generate a sortable tree like this with RoR? http://script.aculo.us/playground/test/functional/sortable_tree_test.html Specifically, the ability to drag a section and its children to another position. I'm using this code currently: <%= sortable_element("articles", :url => "sort", :constraint => :vertical, :tree => true) %> And with a tree rendered like this: - Section 1 - article 1 - article 2 - article 3 - Section 2 - article 4 - Section 3 - article 5 - article 6 If I drag on Section 3, only Section 3 moves, article 5 & 6 don't go along with it. Is there any trick? Thanks, Robert --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: sortable tree in rails
I figured out what I was doing wrong. I had the tag around Section name. If I put the tag around Section and its children, the children move along with the parent. On Feb 6, 12:06 pm, chienr wrote: > Hi, > > I'm a new member to this group, and would appreciate some help with > using Sortable in Rails. > > How do I generate a sortable tree like this with > RoR?http://script.aculo.us/playground/test/functional/sortable_tree_test > > Specifically, the ability to drag a section and its children to > another position. > > I'm using this code currently: > > <%= sortable_element("articles", :url => "sort", :constraint > => :vertical, :tree => true) %> > > And with a tree rendered like this: > > - Section 1 > - article 1 > - article 2 > - article 3 > - Section 2 > - article 4 > - Section 3 > - article 5 > - article 6 > > If I drag on Section 3, only Section 3 moves, article 5 & 6 don't go > along with it. Is there any trick? > > Thanks, > Robert --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] TypeError: Value undefined (result of expression Element.insert) is not object.
Hi, Intermittently, I get a browser popup error that says: RJS error: TypeError: Value undefined (result of expression Element.insert) is not object. My suspicion is that since included javascripts are loaded asynchronously, sometimes prototype.js doesn't finish loading before the page.insert_html is called. Does it sound right? If so, I suppose the solution involves testing whether Element.insert is defined, and if not, wait a little while and test again. What's the best way to do this as there's no sleep() in javascript? Any assistance is appreciated. Thanks, Robert --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: TypeError: Value undefined (result of expression Element.insert) is not object.
Hi david, I don't have an example to show you, and it happens so randomly. FWIW, I'm loading prototype on-demand with element.appendChild(), which probably complicates things a little. I just found reference to setInterval() in Javascript, will look into that to see if it fits my needs. Thanks. On Feb 16, 3:50 pm, david wrote: > Hi robert, > > It's hard to guess your problem, but, javascript are loaded > synchronously, so that not the reason. > If you have an exemple, I could help you? a little bit more !? > > -- > david > > On 16 fév, 23:31, chienr wrote: > > > Hi, > > > Intermittently, I get a browser popup error that says: > > > > > RJS error: > > > TypeError: Value undefined (result of expression Element.insert) is > > not object. > > > > > My suspicion is that since included javascripts are loaded > > asynchronously, sometimes prototype.js doesn't finish loading before > > the page.insert_html is called. Does it sound right? If so, I suppose > > the solution involves testing whether Element.insert is defined, and > > if not, wait a little while and test again. What's the best way to do > > this as there's no sleep() in javascript? > > > Any assistance is appreciated. > > > Thanks, > > Robert --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---