Api: Fix readonly category select did not load application categories

Categories were loaded before attributes & application was not used
This commit is contained in:
nathan 2023-04-03 10:21:46 -06:00
parent 6b98908faa
commit 1702269b65

View File

@ -305,23 +305,21 @@ customElements.define("et2-select-bool_ro", Et2SelectBoolReadonly);
export class Et2SelectCategoryReadonly extends Et2SelectReadonly export class Et2SelectCategoryReadonly extends Et2SelectReadonly
{ {
constructor() protected find_select_options(_attrs)
{ {
super();
// Need to do this in find_select_options so attrs can be used to get proper options
so.cat(this).then(_options => so.cat(this).then(_options =>
{ {
this.select_options = _options; this.select_options = _options;
// on first load we have the value before the options arrive --> need to request an update // 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)) if(this.value && (!Array.isArray(this.value) || this.value.length))
{ {
this.requestUpdate('value'); this.requestUpdate('value');
} }
}); });
} }
protected find_select_options(_attrs) {}
} }
// @ts-ignore TypeScript is not recognizing that this widget is a LitElement // @ts-ignore TypeScript is not recognizing that this widget is a LitElement