From f29da5e6136988c2d50022f5f4dc962fd8793c54 Mon Sep 17 00:00:00 2001 From: ralf Date: Wed, 16 Feb 2022 10:35:09 +0200 Subject: [PATCH] fix TypeError with numbers not iterable also problem with strings - thought no error - as they are iterated letter-wise, which is not what we want here --- api/js/etemplate/Et2Select/Et2SelectReadonly.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/api/js/etemplate/Et2Select/Et2SelectReadonly.ts b/api/js/etemplate/Et2Select/Et2SelectReadonly.ts index 38350a20d8..407c564043 100644 --- a/api/js/etemplate/Et2Select/Et2SelectReadonly.ts +++ b/api/js/etemplate/Et2Select/Et2SelectReadonly.ts @@ -199,7 +199,11 @@ export class Et2SelectAccountReadonly extends Et2SelectReadonly super.value = new_value; return; } - + // fix scalar (number or string) values + if (typeof new_value !== 'object') + { + new_value = [new_value]; + } for(let id of new_value) { let account_name = null; @@ -467,4 +471,4 @@ export class Et2SelectYearReadonly extends Et2SelectReadonly } // @ts-ignore TypeScript is not recognizing that this widget is a LitElement -customElements.define("et2-select-year_ro", Et2SelectYearReadonly); +customElements.define("et2-select-year_ro", Et2SelectYearReadonly); \ No newline at end of file