From ba0214d1ff8cdcc9403fd4db9489e5efcac84eaa Mon Sep 17 00:00:00 2001 From: Mojca Lorber Date: Tue, 20 Dec 2016 15:19:31 +0100 Subject: [PATCH] staying on same page after saving a sample; fix button disappearance when adding new column --- .../javascripts/samples/sample_datatable.js.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/samples/sample_datatable.js.erb b/app/assets/javascripts/samples/sample_datatable.js.erb index 53a3d8f98..60078765e 100644 --- a/app/assets/javascripts/samples/sample_datatable.js.erb +++ b/app/assets/javascripts/samples/sample_datatable.js.erb @@ -651,7 +651,7 @@ function clearAllErrors() { // Restore previous table function onClickCancel() { - table.ajax.reload(); + table.draw('page'); changeToViewMode(); updateButtons(); @@ -881,6 +881,11 @@ function changeToEditMode() { I18n.t('samples.js.column_added') + ''); + // 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(); @@ -902,11 +907,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(); table.on('init.dt', function() {