Et2Select: Fix change event got fired too early

If fix_bad_value() made a change, that was triggering change event before Et2App.et2_ready() had been called
This commit is contained in:
nathan 2022-11-07 09:56:26 -07:00
parent 8b83ed85d3
commit 78333613fa
3 changed files with 9 additions and 6 deletions

View File

@ -20,7 +20,7 @@
<row class="th"> <row class="th">
<nextmatch-sortheader label="Name" id="name"/> <nextmatch-sortheader label="Name" id="name"/>
<nextmatch-sortheader label="Description" id="description"/> <nextmatch-sortheader label="Description" id="description"/>
<nextmatch-filterheader label="Application" id="app" options=","/> <nextmatch-filterheader label="Application" id="app"/>
<nextmatch-accountfilter label="Owner" id="owner" options="all,both"/> <nextmatch-accountfilter label="Owner" id="owner" options="all,both"/>
<nextmatch-filterheader label="Private" id="access" options="All"/> <nextmatch-filterheader label="Private" id="access" options="All"/>
<nextmatch-header align="center" label="Icon" id="icon"/> <nextmatch-header align="center" label="Icon" id="icon"/>

View File

@ -106,11 +106,14 @@ export const Et2widgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
{ {
super.updated(changedProperties); super.updated(changedProperties);
// If the ID changed (or was just set) find the select options // If the ID changed (or was just set) and select_options wasn't, find the new select options
if(changedProperties.has("id")) if(changedProperties.has("id") && !changedProperties.has("select_options"))
{ {
const options = find_select_options(this, {}, this._xmlOptions); const options = find_select_options(this, {}, this._xmlOptions);
if (options.length) this.select_options = options; if(options.length)
{
this.select_options = options;
}
} }
// 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
@ -120,7 +123,7 @@ export const Et2widgetWithSelectMixin = <T extends Constructor<LitElement>>(supe
this._renderOptions(); this._renderOptions();
// This is needed to display initial load value in some cases, like infolog nm header filters // This is needed to display initial load value in some cases, like infolog nm header filters
if(this.handleMenuSlotChange) if(this.handleMenuSlotChange && !this.hasUpdated)
{ {
this.handleMenuSlotChange(); this.handleMenuSlotChange();
} }

View File

@ -3627,7 +3627,7 @@ export class et2_nextmatch_header_bar extends et2_DOMWidget implements et2_INext
} }
} }
// Legacy: Add in 'All' option for cat_id, if not provided. // Legacy: Add in 'All' option for cat_id, if not provided.
if(name == 'cat_id' && options != null && (typeof options[''] == 'undefined' && typeof options[0] != 'undefined' && options[0].value != '')) if(name == 'cat_id' && (options == null || options != null && (typeof options[''] == 'undefined' && typeof options[0] != 'undefined' && options[0].value != '')))
{ {
widget_options.empty_label = this.egw().lang('All categories'); widget_options.empty_label = this.egw().lang('All categories');
} }