diff --git a/app/assets/javascripts/repositories/my_module_repository.js b/app/assets/javascripts/repositories/my_module_repository.js index cc22b599c..96c232b65 100644 --- a/app/assets/javascripts/repositories/my_module_repository.js +++ b/app/assets/javascripts/repositories/my_module_repository.js @@ -1,10 +1,15 @@ (function() { 'use strict'; - // initialze repository datatable - $(document).ready(function() { + function initTable() { RepositoryDatatable.destroy() RepositoryDatatable.init($('#content').attr('data-repo-id')); + RepositoryDatatable.redrawTableOnSidebarToggle(); + } + + // initialze repository datatable + $(document).ready(function() { + initTable() onClickToggleAssignedRecords(); }); })(); diff --git a/app/assets/javascripts/repositories/repository_datatable.js.erb b/app/assets/javascripts/repositories/repository_datatable.js.erb index 3075232a8..8c497cdb8 100644 --- a/app/assets/javascripts/repositories/repository_datatable.js.erb +++ b/app/assets/javascripts/repositories/repository_datatable.js.erb @@ -1256,8 +1256,17 @@ var RepositoryDatatable = (function(global) { TABLE_ID = ''; } + function redrawTableOnSidebarToggle() { + $('#sidebar-arrow').on('click', function() { + setTimeout(function() { + TABLE.draw(); + }, 250); + }); + } + return Object.freeze({ init: init, - destroy: destroy + destroy: destroy, + redrawTableOnSidebarToggle: redrawTableOnSidebarToggle }); })(window); diff --git a/app/assets/javascripts/repositories/show.js b/app/assets/javascripts/repositories/show.js index 8bbda98e3..925ee4d77 100644 --- a/app/assets/javascripts/repositories/show.js +++ b/app/assets/javascripts/repositories/show.js @@ -8,6 +8,12 @@ }); } + function initTable() { + RepositoryDatatable.destroy(); + RepositoryDatatable.init('#' + $('.repository-table table').attr('id')); + RepositoryDatatable.redrawTableOnSidebarToggle(); + } + function _initParseRecordsModal() { $('#form-records-file').on('ajax:success', function(ev, data) { $('#modal-import-records').modal('hide'); @@ -30,8 +36,7 @@ function initialzerRepositoryTable() { initImportRecordsModal(); - RepositoryDatatable.destroy(); - RepositoryDatatable.init('#' + $('.repository-table table').attr('id')); + initTable(); } $(document).ready(initialzerRepositoryTable);