Forum: Ruby on Rails Strange problem with partials and drag and drop

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
25cc4b4f00c2adcef7dd775576adad1e?d=identicon&s=25 Rajkumar S (Guest)
on 2007-02-20 15:28
(Received via mailing list)

I am playing with a small test app for drag and drop. The structure is
as follows:

<div id="update_status">
  <div id="queue_list">
      <li id="id1001" class="queue_item" style="position: relative;">
1001 11384</li>
      <script type="text/javascript"> //The javascript appears below
  <div id="agent_list" style="position: relative;">
      <li class="agent_item">Test User (AGENT_IDLE)</li>

The javascript fragment in queue_list <ul><li> is

<script type="text/javascript">
new Draggable("id1001", {ghosting:true, revert:true})

The view code for generating this consists of 3 partials,

<div id="queue_list">
  <%= render(:partial => 'update_queue') -%>
<div id="agent_list">
  <%= render(:partial => 'update_agent') -%>

<% @queue.each do |q| -%>
<% domid = "id#{q[:callerid]}" -%>
<li class="queue_item" id='<%= domid -%>'> <%= q[:callerid]-%> <%=
q[:wait] -%></li>
<%= draggable_element domid, :ghosting=>true, :revert=>true  %>
<% end -%>

<%@agent.each do |q| -%>
<li class="agent_item"><%= q[:name] -%> (<%=q[:status]-%>)</li>
<% end -%>

main view is index.rhtml

<div id='update_status'>
  <%= render(:partial => 'update_status') -%>

<%= link_to_remote 'Check Status...',
    :url => {:action => 'index'},
    :update => 'update_status' %>

<%= drop_receiving_element('agent_list',
      :accept     => 'queue_item',
      :hoverclass => 'hover',
      :with       => "'queue=' + encodeURIComponent(" ,
      :url        => {:action=>:index})%>

This just defined the update_status div and a "check status" link. In
the controller I have code like this

    if request.xml_http_request?
      render :partial => "update_status", :layout => false

All pretty standard stuff.

Now When I do a full page refresh I get the full code and I am able to
drag and drop, but strangely if I click the "check status" link the
java script in queue_list <ul><li> is missing. To illustrate further
let me attach some screen shot of firebug with and with out problem.

1. After a full refresh (via browser reload button)

2. After I click the "check status" link

3. Even more strange is the fact that response from server does indeed
have the necessary javascript. The firebug console with response

I am pulling my hair out due to this issue for the past 3 days, If you
need any more info please feel free to ask.

Thanks for reading, and hopefully, for answering

This topic is locked and can not be replied to.