Make sure the sort and shadowRoot are there before using them, avoiding execution error, since getValue it could be called in earlier stage eg: a699117b1b

This commit is contained in:
Hadi Nategh 2023-01-16 12:55:45 +01:00
parent 5bc7ed497c
commit 10c646a367

View File

@ -206,7 +206,7 @@ export class Et2ColumnSelection extends Et2InputWidget(LitElement)
{ {
let value = []; let value = [];
this.sort.toArray().forEach((val) => this.sort?.toArray().forEach((val) =>
{ {
let column = this.__columns.find((col) => col.id == val); let column = this.__columns.find((col) => col.id == val);
let menuItem = <SlMenuItem>this.shadowRoot.querySelector("[value='" + val + "']"); let menuItem = <SlMenuItem>this.shadowRoot.querySelector("[value='" + val + "']");
@ -227,7 +227,7 @@ export class Et2ColumnSelection extends Et2InputWidget(LitElement)
}); });
// Add in letters // Add in letters
this.shadowRoot.querySelectorAll("[part='columns'] > :not(.column)").forEach((i : SlMenuItem) => this.shadowRoot?.querySelectorAll("[part='columns'] > :not(.column)").forEach((i : SlMenuItem) =>
{ {
if(i.checked) if(i.checked)
{ {