Forum: Ruby on Rails Updating a new id created from Ajax call in the same .js.rjs

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D48be99143e13e40d1c44a4da63a53f4?d=identicon&s=25 Mongeta 99 (raimon)
on 2009-03-31 18:57
Hello,

I'm playing a little with ajax and some visual effects.

What I'm doing is creating and modifying rows, open a new window with
ajax, do the stuff, and update the main div page with the new row. The
action can be add a new row, modify a present row, or delete a row.

If the row has been modified, I can issue a page <<
visual_effect(:highlight, @invoices_line.id.to_s, :duration => 3) and
see the new row updated.

The problem, is that when I add a new row, the new id doesn't exist in
the main page, but it really exists in the new updated div, but it seems
that the javascript can't find it.

Without reloading, modifying the just created row, the visual effect
works.

Maybe isn't working because I'm calling the visaul effect after the
update and the browser/javascript doesn't know (yet) the newly ID ?

For testing purposes I added an alert with the new id to see if it
really exists, and before the alert I update the div, and I can see that
the new row with the new id really exists (has been updated...)

The error that I'm getting is RJS Error  [obejct Object]

any ideas ?

thanks ...

r.
This topic is locked and can not be replied to.