fix: [genericElement:index_table] Better support of nested dropdown if it has been added after page load
parent
7940920f3d
commit
8686aa87a6
|
@ -65,6 +65,7 @@ echo $availableColumnsHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
addSupportOfNestedDropdown();
|
||||||
const $form = $('form.visible-column-form')
|
const $form = $('form.visible-column-form')
|
||||||
const $checkboxes = $form.find('input').not(':checked')
|
const $checkboxes = $form.find('input').not(':checked')
|
||||||
const $dropdownMenu = $form.closest('.dropdown')
|
const $dropdownMenu = $form.closest('.dropdown')
|
||||||
|
|
|
@ -243,8 +243,13 @@ function overloadBSDropdown() {
|
||||||
return _orginal.call(this);
|
return _orginal.call(this);
|
||||||
}
|
}
|
||||||
}($bs.Dropdown.prototype.toggle);
|
}($bs.Dropdown.prototype.toggle);
|
||||||
|
})(bootstrap);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addSupportOfNestedDropdown() {
|
||||||
|
const CLASS_NAME_HAS_CHILD = 'has-child-dropdown-show';
|
||||||
document.querySelectorAll('.dropdown').forEach(function (dd) {
|
document.querySelectorAll('.dropdown').forEach(function (dd) {
|
||||||
|
if (dd.getAttribute('data-listener-registered') === null) { // Only add listener once
|
||||||
dd.addEventListener('hide.bs.dropdown', function (e) {
|
dd.addEventListener('hide.bs.dropdown', function (e) {
|
||||||
if (this.classList.contains(CLASS_NAME_HAS_CHILD)) {
|
if (this.classList.contains(CLASS_NAME_HAS_CHILD)) {
|
||||||
this.classList.remove(CLASS_NAME_HAS_CHILD);
|
this.classList.remove(CLASS_NAME_HAS_CHILD);
|
||||||
|
@ -261,8 +266,9 @@ function overloadBSDropdown() {
|
||||||
}
|
}
|
||||||
e.stopPropagation(); // do not need pop in multi level mode
|
e.stopPropagation(); // do not need pop in multi level mode
|
||||||
});
|
});
|
||||||
|
dd.setAttribute('data-listener-registered', 1)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
})(bootstrap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var UI
|
var UI
|
||||||
|
@ -271,6 +277,7 @@ $(document).ready(() => {
|
||||||
UI = new UIFactory()
|
UI = new UIFactory()
|
||||||
}
|
}
|
||||||
overloadBSDropdown();
|
overloadBSDropdown();
|
||||||
|
addSupportOfNestedDropdown();
|
||||||
|
|
||||||
const debouncedGlobalSearch = debounce(performGlobalSearch, 400)
|
const debouncedGlobalSearch = debounce(performGlobalSearch, 400)
|
||||||
$('#globalSearch')
|
$('#globalSearch')
|
||||||
|
|
Loading…
Reference in New Issue