# Ajax list removal

**URL:** <https://www.ruby-forum.com/t/ajax-list-removal/105800>\
**Category:** Rails\
**Created:** [June 3, 2007, 12:49am UTC](https://www.ruby-forum.com/t/ajax-list-removal/105800 "2007-06-03T00:49:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [June 3, 2007, 12:49am UTC](https://www.ruby-forum.com/t/ajax-list-removal/105800/1 "2007-06-03T00:49:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [June 3, 2007, 5:32am UTC](https://www.ruby-forum.com/t/ajax-list-removal/105800/2 "2007-06-03T05:32:10Z")

</div>

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

, you’ll be very limited to what  
you  
can do with Ajax. Best bet is to just re-render the table.

hth,  
Bill

---

<div class="post-metadata">

**Author:** ![dgm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df788c/32.png) [@dgm](https://www.ruby-forum.com/u/dgm)\
**Post date:** [June 3, 2007, 6:21am UTC](https://www.ruby-forum.com/t/ajax-list-removal/105800/3 "2007-06-03T06:21:12Z")

</div>

On Jun 2, 6:49 pm, David M. \<rails-mailing-l…@andreas-  
[s.net](http://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?
