From dabeb0650fa7665d4fec2318c27e0a60c833a95c Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 14 Aug 2025 14:00:09 +0200 Subject: [PATCH] Fix search in select dropdown [SCI-12261] --- app/javascript/vue/shared/select_dropdown.vue | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/javascript/vue/shared/select_dropdown.vue b/app/javascript/vue/shared/select_dropdown.vue index f95f7a02e..ae7e8eeaa 100644 --- a/app/javascript/vue/shared/select_dropdown.vue +++ b/app/javascript/vue/shared/select_dropdown.vue @@ -149,7 +149,8 @@ export default { fixedWidth: true, focusedOption: null, skipQueryCallback: false, - nextPage: 1 + nextPage: 1, + totalOptionsCount: this.options.length }; }, mixins: [FixedFlyoutMixin], @@ -226,11 +227,11 @@ export default { if (this.newValue.length === 0) { return false; } - if (this.newValue.length === 1 && this.rawOptions.length > 1) { + if (this.newValue.length === 1 && this.totalOptionsCount > 1) { this.selectAllState = 'indeterminate'; return this.renderLabel(this.rawOptions.find((option) => option[0] === this.newValue[0])); } - if (this.newValue.length === this.rawOptions.length) { + if (this.newValue.length === this.totalOptionsCount) { this.selectAllState = 'checked'; return this.allOptionsPlaceholder || this.i18n.t('general.select_dropdown.all_options_placeholder'); } @@ -264,7 +265,6 @@ export default { if (!this.newValue && this.multiple) { this.newValue = []; } - this.fetchOptions(); }, watch: { value(newValue) { @@ -318,6 +318,7 @@ export default { }, open() { if (!this.disabled) this.isOpen = true; + this.fetchOptions(); }, clear() { this.newValue = this.multiple ? [] : null; @@ -391,6 +392,11 @@ export default { } else { this.fetchedOptions = response.data.data; } + + if (this.fetchedOptions.length > this.totalOptionsCount) { + this.totalOptionsCount = this.fetchedOptions.length; + } + this.$nextTick(() => { this.setPosition(); });