Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems getting AJAX effect to work with RubyOnRails
    primarykey
    data
    text
    <p>I want to remove a row from an HTML table generated by some Rails code and I'd like the other rows to "Slide Up" into the new position.</p> <p>I'm kind of new to this and I'm sure I've probably made a simple mistake.</p> <p>Here is the partial code to generate the table row:</p> <pre><code>&lt;tr id="ride_&lt;%=h ride.id %&gt;"&gt; &lt;td&gt;&lt;%=h ride.name %&gt;&lt;/td&gt; &lt;td&gt;&lt;%=h ride.land %&gt;&lt;/td&gt; &lt;td align="right"&gt;&lt;%=h ride.height_restriction %&gt;&lt;/td&gt; &lt;td&gt;&lt;%= link_to_remote 'remove', :url =&gt; { :action =&gt; :destroy, :ride_id =&gt; ride.id }, :html =&gt; {:onclick =&gt; "Effect.SlideUp('ride_" + ride.id.to_s + "')"} %&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>And here is the HTML generated from that partial:</p> <pre><code>&lt;tr id="ride_130"&gt; &lt;td&gt;thrill ride&lt;/td&gt; &lt;td&gt;fun land&lt;/td&gt; &lt;td align="right"&gt;40&lt;/td&gt; &lt;td&gt;&lt;a href="#" onclick="Effect.SlideUp('ride_130'); new Ajax.Request('/SimpleRailsApp/rides/destroy?ride_id=130', {asynchronous:true, evalScripts:true, parameters:'authenticity_token=' + encodeURIComponent('9f2334b84d2da7eddfbfaadf8138c0a1c8feca47')}); return false;"&gt;remove&lt;/a&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>Now, the row deletes alright, but I don't get the cool AJAX effect. It just sort of "snaps" up. </p> <p>So far "Puff" is the only effect I've been able to make work.</p> <p>Any help or advice would be appreciated.</p> <p><strong>UPDATE</strong></p> <p>Could it be that this effect does not work inside of a table element? I've tried almost the exact code on an unordered list and it seems to work fine.</p> <p>I've also found this <a href="https://stackoverflow.com/questions/467336/jquery-how-to-use-slidedown-or-show-function-on-a-table-row/920480#920480">other question</a> that says animations don't work on tables in jQuery either, so I may be out of luck here.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload