Gareth, I believe #replace should be able to do this just fine. -- kangax
On Jul 1, 8:44 pm, "Gareth Evans" <[EMAIL PROTECTED]> wrote: > 1) get a reference to your tr (for example using > table.select('tr:nth-child(4)').reduce() ) > 2) use tr.insert({before: new Element('tr').insert(new > Element('td').update('hai')) }); //or variant of insert with innerhtml > content from ajax request > 3) tr.remove(); > > On Wed, Jul 2, 2008 at 12:24 PM, kermit <[EMAIL PROTECTED]> wrote: > > > Hi, > > > Hopefully a quick example will illustrate what I'm trying to do. > > > <table> > > <tr> > > <td>test</td> > > <td>test</td> > > </tr> > > <tr> > > <td>row 2</td> > > <td>row 2</td> > > </tr> > > <tr> > > <td>row 3</td> > > <td>row 3</td> > > </tr> > > </table> > > > Using AJAX, I'd like to be able to replace an entire <tr> block, for > > example to give: > > > <table> > > <tr> > > <td>test</td> > > <td>test</td> > > </tr> > > > </table> > > <p>This is dynamic content</p> > > <table> > > > <tr> > > <td>row 3</td> > > <td>row 3</td> > > </tr> > > </table> > > > I (wrongly) assumed the solution would just be: > > > <table> > > <tr> > > <td>test</td> > > <td>test</td> > > </tr> > > <div id='mycontent'> > > <tr> > > <td>row 2</td> > > <td>row 2</td> > > </tr> > > </div> > > <tr> > > <td>row 3</td> > > <td>row 3</td> > > </tr> > > </table> > > > ... then use AJAX to replace the contents of the 'mycontent' div. > > Unfortunately when this renders (in Firefox anyway), the div is placed > > outside of the table (above it), so any content written to the div > > also appear outside of the table (I confirmed the position of the div > > by putting a border around it). Perhaps this is to be expected since > > in standard HTML the div shouldn't be where it is. > > > So my question is how I can achieve this replacement of the table row > > > Best, > > Mark --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-spinoffs@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---