Et2Select: Move option rendering into its own function, call it for Et2SelectAccount. This fixes missing option/label in some cases

eg: Kanban edit column Add/Remove assigned
This commit is contained in:
nathan 2022-08-15 10:30:30 -06:00
parent 5ff0cd7451
commit ddee9a2b59
2 changed files with 24 additions and 7 deletions

View File

@ -47,6 +47,13 @@ export class Et2SelectAccount extends Et2Select
this.__accountType = 'accounts'; this.__accountType = 'accounts';
} }
firstUpdated(changedProperties?)
{
super.firstUpdated(changedProperties);
// Due to the different way Et2SelectAccount handles options, we call this explicitly
this._renderOptions();
}
set accountType(type : AccountType) set accountType(type : AccountType)
{ {
this.__accountType = type; this.__accountType = type;

View File

@ -115,6 +115,21 @@ export const Et2widgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
// Add in actual option tags to the DOM based on the new select_options // Add in actual option tags to the DOM based on the new select_options
if(changedProperties.has('select_options') || changedProperties.has("emptyLabel")) if(changedProperties.has('select_options') || changedProperties.has("emptyLabel"))
{
// Add in options as children to the target node
this._renderOptions();
if(this.handleMenuSlotChange)
{
this.handleMenuSlotChange();
}
}
}
/**
* Render select_options as child DOM Nodes
* @protected
*/
protected _renderOptions()
{ {
// Add in options as children to the target node // Add in options as children to the target node
if(this._optionTargetNode) if(this._optionTargetNode)
@ -124,11 +139,6 @@ export const Et2widgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
this._optionTargetNode this._optionTargetNode
); );
} }
if(this.handleMenuSlotChange)
{
this.handleMenuSlotChange();
}
}
} }
/** /**