diff --git a/app/assets/javascripts/samples/sample_datatable.js.erb b/app/assets/javascripts/samples/sample_datatable.js.erb index d8c8ea928..16906b623 100644 --- a/app/assets/javascripts/samples/sample_datatable.js.erb +++ b/app/assets/javascripts/samples/sample_datatable.js.erb @@ -1213,6 +1213,11 @@ function changeToEditMode() { form .on('ajax:success', function() { + // Preserve save/delete buttons as we need them after new table + // will be created + $('div.toolbarButtons').appendTo('div.samples-table'); + $('div.toolbarButtons').hide(); + // Destroy datatable table.destroy(); @@ -1234,11 +1239,6 @@ function changeToEditMode() { $('#samples thead').empty(); $('#samples thead').append(originalHeader); - // Preserve save/delete buttons as we need them after new table - // will be created - $('div.toolbarButtons').appendTo('div.samples-table'); - $('div.toolbarButtons').hide(); - // Re-initialize datatable table = dataTableInit(); loadColumnsNames();