From d26ed9bfce8a98326119d261ddba6c7f8b012b27 Mon Sep 17 00:00:00 2001 From: ralf Date: Thu, 21 Jul 2022 11:50:05 +0200 Subject: [PATCH] fix not displayed r/o et2-select-cat values --- api/js/etemplate/Et2Select/Et2SelectReadonly.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/Et2Select/Et2SelectReadonly.ts b/api/js/etemplate/Et2Select/Et2SelectReadonly.ts index 74873bcf82..4eac4c5f49 100644 --- a/api/js/etemplate/Et2Select/Et2SelectReadonly.ts +++ b/api/js/etemplate/Et2Select/Et2SelectReadonly.ts @@ -162,7 +162,7 @@ li { render() { - if(!this.value) + if(!this.value || Array.isArray(this.value) && !this.value.length) { return this._readonlyRender({label: this.empty_label, value: ""}); } @@ -328,7 +328,16 @@ export class Et2SelectCategoryReadonly extends Et2SelectReadonly { super(); - this.select_options = so.cat(this, {other: this.other || []}); + so.cat(this).then(_options => + { + this.select_options = _options; + + // on first load we have the value before the options arrive --> need to request an update + if (this.value && (!Array.isArray(this.value) || this.value.length)) + { + this.requestUpdate('value'); + } + }); } protected find_select_options(_attrs) {}