subtab bug fix
This commit is contained in:
parent
994d44cdaf
commit
5cf9e982dd
|
|
@ -169,18 +169,28 @@ function setup_custom_subtabs(wrapper, currentDoctype) {
|
|||
|
||||
// Function to setup main tab handler
|
||||
function setupMainTabHandler() {
|
||||
wrapper.off("shown.bs.tab.customsubtabs")
|
||||
.on("shown.bs.tab.customsubtabs", "button.nav-link:not(.sub-tab button.nav-link), a.nav-link:not(.sub-tab a.nav-link)", function(event) {
|
||||
// Удаляем старый обработчик
|
||||
wrapper.off("shown.bs.tab.customsubtabs");
|
||||
|
||||
// Регистрируем новый на wrapper без делегирования
|
||||
wrapper.on("shown.bs.tab.customsubtabs", function(event) {
|
||||
const button = event.target;
|
||||
const tabId = button.getAttribute("aria-controls");
|
||||
const li = $(button).closest("li.nav-item");
|
||||
const $button = $(button);
|
||||
const li = $button.closest("li.nav-item");
|
||||
|
||||
// If this is a subtab - ignore
|
||||
if (li.hasClass("sub-tab")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const tabId = button.getAttribute("aria-controls");
|
||||
|
||||
console.log('shown.bs.tab сработал для:', {
|
||||
text: $button.text().trim(),
|
||||
tabId: tabId,
|
||||
isSubtab: li.hasClass("sub-tab")
|
||||
});
|
||||
|
||||
// ИСПРАВЛЕНИЕ: Убираем active классы со всех субтабов и их контента
|
||||
wrapper.find(".sub-tab").removeClass("active");
|
||||
wrapper.find(".sub-tab button.nav-link, .sub-tab a.nav-link")
|
||||
|
|
@ -199,6 +209,11 @@ function setup_custom_subtabs(wrapper, currentDoctype) {
|
|||
// Show/hide subtabs
|
||||
wrapper.find(".sub-tab-container").each(function() {
|
||||
const containerParentId = $(this).attr("data-parent-id");
|
||||
console.log('Проверка контейнера:', {
|
||||
containerParentId: containerParentId,
|
||||
tabId: tabId,
|
||||
match: containerParentId === tabId
|
||||
});
|
||||
if (containerParentId === tabId) {
|
||||
$(this).removeClass("subtab-hidden");
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue