diff --git a/browser/src/control/Parts.js b/browser/src/control/Parts.js index fde0cd145bced..4596d1b428685 100644 --- a/browser/src/control/Parts.js +++ b/browser/src/control/Parts.js @@ -457,11 +457,11 @@ L.Map.include({ showPage: function () { if (this.getDocType() === 'spreadsheet' && app.calc.isAnyPartHidden()) { var hiddenParts = app.calc.getHiddenPartNameArray(); - + if (app.calc.isAnyPartHidden()) { var container = document.createElement('div'); container.style.maxHeight = '300px'; - container.style.overflowY = 'auto'; + container.style.overflowY = 'auto'; for (var i = 0; i < hiddenParts.length; i++) { var checkbox = document.createElement('input'); checkbox.type = 'checkbox'; @@ -475,7 +475,7 @@ L.Map.include({ container.appendChild(newLine); } } - + var callback = function() { var checkboxList = document.querySelectorAll('input[id^="hidden-part-checkbox"]'); for (var i = 0; i < checkboxList.length; i++) { @@ -486,12 +486,29 @@ L.Map.include({ } } }; - - this.uiManager.showInfoModal('show-sheets-modal', '', ' ', ' ', _('Close'), callback, true, 'show-sheets-modal-response'); + + this.uiManager.showInfoModal('show-sheets-modal', 'Show sheets', ' ', ' ', _('OK'), callback, true, 'show-sheets-modal-response'); const modal = document.getElementById('show-sheets-modal'); modal.insertBefore(container, modal.children[0]); + + var okButton = document.getElementById('show-sheets-modal-response'); + var checkboxes = document.querySelectorAll('#show-sheets-modal input[type="checkbox"]'); + + okButton.disabled = true; + + checkboxes.forEach(function(checkbox) { + checkbox.addEventListener('change', function() { + var anyChecked = false; + checkboxes.forEach(function(checkbox) { + if (checkbox.checked) { + anyChecked = true; + } + }); + okButton.disabled = !anyChecked; + }); + }); } - }, + }, hidePage: function (tabNumber) { if (this.getDocType() === 'spreadsheet' && app.calc.getVisiblePartCount() > 1) {