diff --git a/app/assets/javascripts/repositories/repository_datatable.js b/app/assets/javascripts/repositories/repository_datatable.js index a5c248e0f..5939c6097 100644 --- a/app/assets/javascripts/repositories/repository_datatable.js +++ b/app/assets/javascripts/repositories/repository_datatable.js @@ -567,6 +567,9 @@ var RepositoryDatatable = (function(global) { return columns; }()), drawCallback: function() { + var archived = $('.repository-show').hasClass('archived'); + var archivedOnIndex = TABLE.column('#archived-on').index(); + var archivedByIndex = TABLE.column('#archived-by').index(); animateSpinner(this, false); changeToViewMode(); updateDataTableSelectAllCtrl(); @@ -581,9 +584,7 @@ var RepositoryDatatable = (function(global) { // Hide edit button if not all selected rows are on the current page $('#editRepositoryRecord').prop('disabled', !allSelectedRowsAreOnPage()); - if ($('.repository-show').hasClass('archived')) { - TABLE.columns([6, 7]).visible(true); - } + TABLE.columns([archivedOnIndex, archivedByIndex]).visible(archived); }, preDrawCallback: function() { var archived = $('.repository-show').hasClass('archived'); diff --git a/app/assets/javascripts/repositories/show.js b/app/assets/javascripts/repositories/show.js index d0360ae68..ad9e01d30 100644 --- a/app/assets/javascripts/repositories/show.js +++ b/app/assets/javascripts/repositories/show.js @@ -152,12 +152,12 @@ viewSwitch.on('click', '.view-switch-archived', function() { $('.repository-show').removeClass('active').addClass('archived'); $('#manage-repository-column').removeClass('active').addClass('archived'); - initTable(); + RepositoryDatatable.reload(); }); viewSwitch.on('click', '.view-switch-active', function() { $('.repository-show').removeClass('archived').addClass('active'); $('#manage-repository-column').removeClass('archived').addClass('active'); - initTable(); + RepositoryDatatable.reload(); }); }