Merge pull request #2333 from biosistemika/SCI-4260-fix-the-visibility-of-the-buttons-2

[SCI-4260] Fix the manage buttons visibility after columns reordering
This commit is contained in:
Miha Mencin 2020-01-17 14:34:32 +01:00 committed by GitHub
commit a9add011d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,7 +152,7 @@ var RepositoryDatatable = (function(global) {
function initRowSelection() {
// Handle clicks on checkbox
$('.dt-body-center .repository-row-selector').change(function(ev) {
$(TABLE_ID).on('change', '.repository-row-selector', function(ev) {
var $row;
var data;
var rowId;
@ -250,9 +250,7 @@ var RepositoryDatatable = (function(global) {
if ($('#assigned').text().length === 0) {
TABLE.column(1).visible(false);
}
TABLE.ajax.reload(function() {
initRowSelection();
}, false);
TABLE.ajax.reload(null, false);
changeToViewMode();
SmartAnnotation.closePopup();
animateSpinner(null, false);
@ -497,7 +495,6 @@ var RepositoryDatatable = (function(global) {
// Show number of selected rows near pages info
$('#repository-table_info').append('<span id="selected_info"></span>');
$('#selected_info').html(' (' + rowsSelected.length + ' entries selected)');
initRowSelection();
},
preDrawCallback: function() {
animateSpinner(this);
@ -530,8 +527,7 @@ var RepositoryDatatable = (function(global) {
fnInitComplete: function() {
var tableLengthSelect = $('.dataTables_length select');
var tableFilterInput = $('.dataTables_filter input');
initRowSelection();
bindExportActions();
disableCheckboxToggleOnAssetDownload();
FilePreviewModal.init();
initHeaderTooltip();
@ -596,14 +592,13 @@ var RepositoryDatatable = (function(global) {
$(this).parent().find('.repository-row-selector').trigger('click');
});
TABLE.on('column-reorder', function() {
initRowSelection();
});
$('#assignRepositories, #unassignRepositories').click(function() {
animateLoading();
});
initRowSelection();
bindExportActions();
return TABLE;
}
@ -621,24 +616,16 @@ var RepositoryDatatable = (function(global) {
});
$('#assigned-repo-records').on('click', function() {
var promiseReload;
viewAssigned = 'assigned';
promiseReload = new Promise(function(resolve) {
return new Promise(function(resolve) {
resolve(TABLE.ajax.reload());
});
promiseReload.then(function() {
initRowSelection();
});
});
$('#all-repo-records').on('click', function() {
var promiseReload;
viewAssigned = 'all';
promiseReload = new Promise(function(resolve) {
return new Promise(function(resolve) {
resolve(TABLE.ajax.reload());
});
promiseReload.then(function() {
initRowSelection();
});
});
};