Thanks Tom; this showed me what I had wrong.  I didn't use the 
parentNode of the row and, instead, grabbed a reference to the table 
object forgetting about the tbody that is added.  I switch my code to 
use parentNode, as you did below, and now it works perfectly.

 - Dash -

Tom Gregory wrote:
> The insertion class seems like a lot of overhead.  Why not just use  
> the DOM methods?
>
> //assumes t1, t2; not tested
> var t2sib = t2.nextSibling;
> t1.parentNode.replaceChild(t2, t1);
> t2sib.parentNode.insertBefore(t1, t2sib);
>
>
> TAG
>
> On Apr 25, 2007, at 9:29 AM, David Dashifen Kees wrote:
>
>   
>> What's the best method for swapping two table rows?  For instance,
>> assume you have the following table:
>>
>> <table>
>>     <tr>
>>         <td>1</td>
>>         <td><img src="down.gif"></td>
>>     </tr>
>>     <tr>
>>        <td>2</td>
>>        <td><img src="up.gif"></td>
>>     </tr>
>> </table>
>>
>> What I want to do is swap the two table rows when someone clicks an
>> image.  I thought for sure that things would be golden when I started
>> looking at the Insertion.Before object, but so far it's yielded no  
>> joy.
>>
>> Thanks all,
>>  - Dash -
>>
>>
>>     
>
>
> >
>
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to