Forum: Ruby on Rails ajax list removal

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.
David M. (Guest)
on 2007-06-03 02:49
I have a list of objects that are in a table.  Each row of the table
contains the elements of one object.  The rows have dynamically
generated id's based on the object.

I've created a destroy method for these objects, but I am not sure what
to put in the rjs to remove the object from the list.
Bill W. (Guest)
on 2007-06-03 07:32
(Received via mailing list)
Hi David,

David M. wrote:

> I have a list of objects that are in a table.  Each row of the table
> contains the elements of one object.  The rows have dynamically
> generated id's based on the object.
>
> I've created a destroy method for these objects, but I am not sure what
> to put in the rjs to remove the object from the list.

If you're using tables, as in <table>, you'll be very limited to what
you
can do with Ajax.  Best bet is to just re-render the table.

hth,
Bill
alanG (Guest)
on 2007-06-03 08:21
(Received via mailing list)
On Jun 2, 6:49 pm, David M. <rails-mailing-l...@andreas-
s.net> wrote:
> I have a list of objects that are in a table.  Each row of the table
> contains the elements of one object.  The rows have dynamically
> generated id's based on the object.
>
> I've created a destroy method for these objects, but I am not sure what
> to put in the rjs to remove the object from the list.

I've developed an app that can delete table rows with an Ajax call. I
wrote a javascript delete function and call it from rjs. The script
ultimately uses the built-in remove method:

$('my_row_id').remove();

Since you've written your own method, have you tried simply:

page['my_row_'id].destroy

in your rjs?
This topic is locked and can not be replied to.