mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-15 14:02:17 +00:00
reworked localization of collapsed column headings by modifying internal tabulator logic with custom module
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import ResponsiveLayout from "../../../../vendor/olifolkerd/tabulator5/src/js/modules/ResponsiveLayout/ResponsiveLayout.js";
|
||||
|
||||
export default class ResponsiveLayoutExtensionModule extends ResponsiveLayout {
|
||||
static moduleName = "responsiveLayout";
|
||||
static moduleInitNumber = 1;
|
||||
|
||||
constructor(table) {
|
||||
super(table);
|
||||
}
|
||||
|
||||
generateCollapsedRowData(row) {
|
||||
let result = super.generateCollapsedRowData(row)
|
||||
const isLocalizationEnabled = this.table.options.locale && this.table.options.locale !== "default";
|
||||
const columnHeadingTranslations = this.table?.getLang()?.columns;
|
||||
|
||||
if (isLocalizationEnabled && columnHeadingTranslations) {
|
||||
result = result.map((column) => {
|
||||
if (columnHeadingTranslations[column.field]) {
|
||||
column.title = columnHeadingTranslations[column.field];
|
||||
}
|
||||
return column;
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user