diff --git a/resources/js/src/modules/functions.ts b/resources/js/src/modules/functions.ts
index 7baf470f27..79b62213a2 100644
--- a/resources/js/src/modules/functions.ts
+++ b/resources/js/src/modules/functions.ts
@@ -2484,42 +2484,44 @@ export function onloadEnumSetEditor (): void {
searchIn = '';
}
- var seeMore = '';
+ let seeMore = '';
if (listSize > maxRows) {
- seeMore = '
';
+ seeMore = '';
}
- var centralColumnsDialog = '' +
- '
' +
- searchIn +
- '
' +
- '
' +
- seeMore +
- '
';
+ let centralColumnsModal = document.getElementById('centralColumnsModal');
+ if (centralColumnsModal === null) {
+ const centralColumnsModalHtml = '\n' +
+ '
\n' +
+ '
\n' +
+ ' \n' +
+ '
\n' +
+ searchIn +
+ '
' +
+ '
\n' +
+ ' \n' +
+ '
\n' +
+ '
\n' +
+ '
\n';
- var width = parseInt(
- ((parseInt($('html').css('font-size'), 10) / 13) * 500).toString(),
- 10
- );
- if (! width) {
- width = 500;
+ document.body.insertAdjacentHTML('beforeend', centralColumnsModalHtml);
+ centralColumnsModal = document.getElementById('centralColumnsModal');
}
- var buttonOptions = {};
- var $centralColumnsDialog = $(centralColumnsDialog).dialog({
- classes: {
- 'ui-dialog-titlebar-close': 'btn-close'
- },
- minWidth: width,
- maxHeight: 450,
- modal: true,
- title: window.Messages.pickColumnTitle,
- buttons: buttonOptions,
- open: function () {
+ const modal = window.bootstrap.Modal.getOrCreateInstance(centralColumnsModal);
+
+ centralColumnsModal.addEventListener(
+ 'shown.bs.modal',
+ function () {
$('#col_list').on('click', '.pick', function () {
- $centralColumnsDialog.remove();
+ modal.hide();
});
$('.filter_rows').on('keyup', function () {
@@ -2560,19 +2562,21 @@ export function onloadEnumSetEditor (): void {
$('#seeMore').hide();
}
- return false;
+ modal.handleUpdate();
});
+ }
+ );
- $(this).closest('.ui-dialog').find('.ui-dialog-buttonpane button').first().trigger('focus');
- },
- close: function () {
+ centralColumnsModal.addEventListener(
+ 'hidden.bs.modal',
+ function () {
$('#col_list').off('click', '.pick');
$('.filter_rows').off('keyup');
$(this).remove();
}
- });
+ );
- return false;
+ modal.show();
});
// When "add a new value" is clicked, append an empty text field