// Handle more advanced DOM update after AJAX database manipulation. // See publish/subscribe design pattern in /doc. (function(w) { $('#order_article_<%= @order_article.id %>').remove(); // just to be sure: remove table row which is added below $('#order_articles tr').removeClass('success'); var order_article_entry = $( '<%= j render(partial: 'edit_amount', locals: {order_article: @order_article}) %>' ).addClass('success'); $('#order_articles tbody').append(order_article_entry); updateSort('#order_articles'); $('#add_article_<%= @order_article.article.id %>').remove(); // remove option to add this article })(window);