I have a list of items that I render via a call to a partial
render @items
each item is placed inside a div and has a JS 'disable' link
<div id="item_id_<%=item.id%>
<%=item.name>
<%= link_to disable_item_path(item), :remote => true %>
</div>
Inside the controller, I change the flag of the item in the database to False, and want to re-render the page and remove the item from the list.
I have been doing so by the following code in disable.js.coffee
$('#items_list').html("<%= escape_javascript(render(:partial => @items)) %>")
My question: I would like simply to hide the specific item DIV, and not re-render all the items on the page (why? because I think it's better coding).
How do I do that? I tried passing @item_id to the coffeescript, and doing something like
$('item_id'+@item_id).hide
but from reading around here it seems like it's the wrong way of doing so.
Thanks!