From 78333613fa50226c0dc617e371977166e4990d55 Mon Sep 17 00:00:00 2001 From: nathan Date: Mon, 7 Nov 2022 09:56:26 -0700 Subject: [PATCH] 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 --- admin/templates/default/categories.index.xet | 2 +- .../etemplate/Et2Select/Et2WidgetWithSelectMixin.ts | 11 +++++++---- api/js/etemplate/et2_extension_nextmatch.ts | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/admin/templates/default/categories.index.xet b/admin/templates/default/categories.index.xet index f3f80e8356..9cc550b5a2 100644 --- a/admin/templates/default/categories.index.xet +++ b/admin/templates/default/categories.index.xet @@ -20,7 +20,7 @@ - + diff --git a/api/js/etemplate/Et2Select/Et2WidgetWithSelectMixin.ts b/api/js/etemplate/Et2Select/Et2WidgetWithSelectMixin.ts index eafd9d101a..5e52fdd6e6 100644 --- a/api/js/etemplate/Et2Select/Et2WidgetWithSelectMixin.ts +++ b/api/js/etemplate/Et2Select/Et2WidgetWithSelectMixin.ts @@ -106,11 +106,14 @@ export const Et2widgetWithSelectMixin = >(supe { super.updated(changedProperties); - // If the ID changed (or was just set) find the select options - if(changedProperties.has("id")) + // If the ID changed (or was just set) and select_options wasn't, find the new select options + if(changedProperties.has("id") && !changedProperties.has("select_options")) { 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 @@ -120,7 +123,7 @@ export const Et2widgetWithSelectMixin = >(supe this._renderOptions(); // 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(); } diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index c15976b9c5..eb89322581 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -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. - 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'); }