fix only_app attribute not taking into account when setting value, which is in that case just an id

This commit is contained in:
ralf 2022-06-22 15:29:21 +02:00
parent 7f877082d2
commit 673e0b859c

View File

@ -301,7 +301,7 @@ export class Et2LinkEntry extends Et2InputWidget(FormControlMixin(ValidateMixin(
set value(val : LinkInfo | string | number) set value(val : LinkInfo | string | number)
{ {
let value : LinkInfo = {app: "", id: ""}; let value : LinkInfo = {app: this.only_app, id: ""};
if(typeof val === 'string' && val.length > 0) if(typeof val === 'string' && val.length > 0)
{ {
@ -309,9 +309,16 @@ export class Et2LinkEntry extends Et2InputWidget(FormControlMixin(ValidateMixin(
{ {
val = val.replace(",", ":"); val = val.replace(",", ":");
} }
const vals = val.split(':'); if (val.indexOf(':') > 0)
value.app = vals[0]; {
value.id = vals[1]; const vals = val.split(':');
value.app = vals[0];
value.id = vals[1];
}
else
{
value.id = val;
}
} }
else if(typeof val === "number" && val) else if(typeof val === "number" && val)
{ {