fixed timing of initial localization of tabulator collapsed column headings

This commit is contained in:
adisposkofh
2026-05-18 14:07:06 +02:00
parent a3dd5a188b
commit 95f09e9114
2 changed files with 12 additions and 10 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ Vue.$collapseFormatter = function (data) {
let item2 = document.createElement("div");
item2.classList.add("col-6");
item.innerHTML = "<strong class=\"collapsedColumnHeading\" field=\"" + col.field + "\">placeholder</strong>";
item.innerHTML = "<strong class=\"collapsedColumnHeading\" tabulator-column-field=\"" + col.field + "\">placeholder</strong>";
item2.innerHTML = col.value ? col.value : "-";
list.appendChild(item);
+11 -9
View File
@@ -215,7 +215,7 @@ export const CoreFilterCmpt = {
this.tabulator.setLocale(newSelectedLanguage);
if (this.$props.tabulatorOptions.responsiveLayoutCollapseFormatter) {
this.localizeCollapsedColumnHeadings(newSelectedLanguage);
this.localizeCollapsedColumnHeadings();
}
},
},
@@ -316,9 +316,6 @@ export const CoreFilterCmpt = {
this.tabulator.on('tableBuilt', () => {
this.tableBuilt = true;
this.$emit('tableBuilt');
if (tabulatorOptions.locale && tabulatorOptions.responsiveLayoutCollapseFormatter) {
this.localizeCollapsedColumnHeadings();
}
});
this.tabulator.on("rowSelectionChanged", data => {
this.selectedData = data;
@@ -357,9 +354,6 @@ export const CoreFilterCmpt = {
this.selectedFields = cols.filter(col => col.isVisible()).map(col => col.getField());
if (this.tabulator.options.persistence.headerFilter)
this._setHeaderFilter();
if (tabulatorOptions.locale && tabulatorOptions.responsiveLayoutCollapseFormatter) {
this.localizeCollapsedColumnHeadings();
}
});
}
@@ -368,6 +362,12 @@ export const CoreFilterCmpt = {
this.filterActive = filters.length > 0;
this.$emit("headerFilterOn", this.filterActive);
});
this.tabulator.on('renderComplete', () => {
if (tabulatorOptions.locale && tabulatorOptions.responsiveLayoutCollapseFormatter && this.tableBuilt) {
this.localizeCollapsedColumnHeadings();
}
});
},
async configureTabulatorLocalizations(tabulatorOptions) {
tabulatorOptions.locale = this.$p.user_language.value;
@@ -485,12 +485,14 @@ export const CoreFilterCmpt = {
return tabulatorOptions;
},
async localizeCollapsedColumnHeadings() {
const columnHeadings = this.tabulator.getLang().columns;
const columnHeadings = this.tabulator?.getLang()?.columns;
if (!columnHeadings) return;
this.$refs.table
.querySelectorAll(".collapsedColumnHeading")
.forEach((collapsedColumnHeadingElement) => {
const field = collapsedColumnHeadingElement.getAttribute("field");
const field =
collapsedColumnHeadingElement.getAttribute("tabulator-column-field");
if (!field?.length) return;
collapsedColumnHeadingElement.innerHTML =