From f72497db139aa098acf0735f39d8ff54f51722e4 Mon Sep 17 00:00:00 2001 From: ralf Date: Tue, 3 May 2022 11:26:55 +0200 Subject: [PATCH] HistoryLog: use new Et2DateTimeReadonly widget thought set_value of web-component get not called and nothing is displayed therefore --- api/js/etemplate/et2_widget_historylog.ts | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/api/js/etemplate/et2_widget_historylog.ts b/api/js/etemplate/et2_widget_historylog.ts index 6ee0ff959e..90c46abe8f 100644 --- a/api/js/etemplate/et2_widget_historylog.ts +++ b/api/js/etemplate/et2_widget_historylog.ts @@ -30,6 +30,7 @@ import {et2_IDetachedDOM, et2_IResizeable} from "./et2_core_interfaces"; import {et2_dynheight} from "./et2_widget_dynheight"; import {et2_customfields_list} from "./et2_extension_customfields"; import {et2_selectbox} from "./et2_widget_selectbox"; +import {loadWebComponent} from "./Et2Widget/Et2Widget"; /** * eTemplate history log widget displays a list of changes to the current record. @@ -302,13 +303,22 @@ export class et2_historylog extends et2_valueWidget implements et2_IDataProvider // Constant widgets - first 3 columns for(let i = 0; i < et2_historylog.columns.length; i++) { - if(et2_historylog.columns[i].widget_type) + const column = et2_historylog.columns[i]; + if(column.widget_type) { // Status ID is allowed to be remapped to something else. Only affects the widget ID though - var attrs = {'readonly': true, 'id': (i == et2_historylog.FIELD ? this.options.status_id : et2_historylog.columns[i].id)}; - et2_historylog.columns[i].widget = et2_createWidget(et2_historylog.columns[i].widget_type, attrs, this); - et2_historylog.columns[i].widget.transformAttributes(attrs); - et2_historylog.columns[i].nodes = jQuery(et2_historylog.columns[i].widget.getDetachedNodes()); + var attrs = {'readonly': true, 'id': (i == et2_historylog.FIELD ? this.options.status_id : column.id)}; + // Create widget, still preferring legacy widgets + if (typeof et2_registry[column.widget_type] !== 'undefined') + { + column.widget = et2_createWidget(column.widget_type, attrs, this); + column.widget.transformAttributes(attrs); + } + else + { + column.widget = loadWebComponent('et2-'+column.widget_type, attrs, this); + } + column.nodes = jQuery(column.widget.getDetachedNodes()); } } @@ -743,4 +753,4 @@ export class et2_historylog extends et2_valueWidget implements et2_IDataProvider } } } -et2_register_widget(et2_historylog, ['historylog']); +et2_register_widget(et2_historylog, ['historylog']); \ No newline at end of file