Simplify JavaScript to toggle investment selection
We don't need to replace the whole row, since the changes only affect the button. Therefore, we don't need to depend on an `inserted` event to decide which columns to render in that row.
This commit is contained in:
@@ -80,9 +80,6 @@
|
||||
App.ColumnsSelector.toggleColumn(event);
|
||||
}
|
||||
});
|
||||
$(".column-selectable").on("inserted", function() {
|
||||
App.ColumnsSelector.initColumns();
|
||||
});
|
||||
},
|
||||
destroy: function() {
|
||||
$("#js-columns-selector-wrapper").children(":not(#column_selector_item_template)").remove();
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
$("#<%= dom_id(@investment) %>").replaceWith(
|
||||
"<%= j render Admin::BudgetInvestments::RowComponent.new(@investment) %>"
|
||||
).trigger("inserted");
|
||||
$("#<%= dom_id(@investment) %> [data-field='selected']").html(
|
||||
"<%= j render(Admin::BudgetInvestments::ToggleSelectionComponent.new(@investment)) %>"
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user