on 2007-05-09 13:54
on 2007-05-09 14:16
Tom, If I understand you correctly, you are trying to create some dynamic tree in the browser page. The way you want to do it won't work because whatever your JS code generates, this is the client side, the page loaded into the user's browser, and there's no Rails there to evaluate it. Use Rails Ajax capabilities, it's really simple. Read about methods ActionView::Helpers::PrototypeHelper, methods which have the word 'remote' in their names. Instead of JS generating new content for your page there will be partial templates which will be evaluated and the output will be inserted into your page automagically without reloading it. Cheers, Yuri On 5/9/07, Tom V. <firstname.lastname@example.org> wrote: > var rhtmlCode = "<"+"%= live_tree :fstree, ...%>"; > Tom. > > > > -- Best regards, Yuri Leikind
on 2007-05-09 14:19
on 2007-05-09 14:38
Hi Chris, thanks for clarifying that! The output of "live_tree :fstree" actually _IS_ rendered when the overall page is loaded. My problem is that I need to _reload_ the fstree everytime a user creates a new file. The code I posted is just to test "reloading"... I tried to reload live_tree using "render :partial". Its output is rendered, however the whole layout of my site gets broken, all CSS is gone, Firebugs throws millions of errors... If I set ":layout => false" nothing is rendered If I set ":layout => 'myDefaultLayout'", everything breaks apart. Any idea? Thanks for your help! Tom.
on 2007-05-09 14:56
Hi Yuri, thanks for the clarification! And you do understand me right ;-) This rhtml/innerhtml thing actually was only to test "reloading" the tree. I am able to generate and render the tree but only when the whole page is loaded. What I wanna do is reload just the tree, not the whole page. I tried to use "render :partial" but that did not work. using ":layout => 'myDefaultLayout'" obviously cannot work. setting layout to false breaks the whole layout. This is because "live_tree" tries to expand as much as possible. the author recommends to use a surrounding div with height and width specified, however that does not work for me. Thanks for your time. Tom.
on 2007-05-09 15:21