Note that there is nothing special about the partial. The browser has
no idea if the code came from a single template or was generated from
the partials.
So if something doesn't work its unrelated to the partial.
Anyway.... if you have a javascript on that page that does gets
executed you can *add* more code to the same spot from the partial
like this:

<% content_for :on_load do %>
  .... js code to run on load
<% end %>

wherever you have a js code that runs on the load just add:
<%= yield :on_load %>

And it will add whatever was added in the partial.
Note that it will work if the yield is in the layout or in the
template *after* the rendering of the partial, this is because when it
runs the partial must have run already (and layouts code is  the last
to execute btw, so that if you do <% @qwe = 123 %> anywhere in the
templates or partials it will be available in the layout)

Hope this helps.

--
Vitaly Kushner
http://twitter.com/vkushner
Founder, Astrails Ltd. http://astrails.com
Check out our blog: http://blog.astrails.com


On Jul 7, 2:40 am, JannaB <mistressja...@hotmail.com> wrote:
> In my view I have a:
>
> <%= render :partial => 'uplog' %>
>
> and the partial is shown below. Note there is js in it which I thought
> got executed on load (but, I have found out this does NOT happen when
> a partial is loaded. How else can I execute the js below when the
> partial gets loaded (someone said to call it explicitly....but how and
> from where?) THanks, Janna B
>
> <div id="namesdata" style="float: left; width: 200px;">
> names
> </div>
> <div id="rowsdata" style="float: left; ">
> rows
> </div>
> <script>
> startClock('../../../../www/test/ggriptest/getdata1.dat','./
> getdata2.php');
> </script>
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to