diff --git a/app/assets/javascripts/repositories/repository_datatable.js b/app/assets/javascripts/repositories/repository_datatable.js index 61cff3be0..851b07c15 100644 --- a/app/assets/javascripts/repositories/repository_datatable.js +++ b/app/assets/javascripts/repositories/repository_datatable.js @@ -453,10 +453,12 @@ function onClickAssignRecords() { success: function(data) { HelperModule.flashAlertMsg(data.flash, 'success'); onClickCancel(); + clearRowSelection(); }, error: function(data) { HelperModule.flashAlertMsg(data.responseJSON.flash, 'danger'); onClickCancel(); + clearRowSelection(); } }); } @@ -471,10 +473,12 @@ function onClickUnassignRecords() { success: function(data) { HelperModule.flashAlertMsg(data.flash, 'success'); onClickCancel(); + clearRowSelection(); }, error: function(data) { HelperModule.flashAlertMsg(data.responseJSON.flash, 'danger'); onClickCancel(); + clearRowSelection(); } }); } @@ -764,6 +768,13 @@ function clearAllErrors() { $('#alert-container').find('div').remove(); } +function clearRowSelection() { + $('.dt-body-center .repository-row-selector').prop('checked', false); + $('.dt-body-center .repository-row-selector').closest('tr') + .removeClass('selected'); + rowsSelected = []; +} + // Restore previous table function onClickCancel() { if ($('#assigned').text().length === 0) {