From 24ea912ca58a83bb8ee469490c75b0b588c9bf1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Thu, 22 Feb 2024 15:43:56 +0300 Subject: [PATCH] Fixed #14801 and Fixed #14815 --- src/app/components/dropdown/dropdown.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/app/components/dropdown/dropdown.ts b/src/app/components/dropdown/dropdown.ts index 27a02ee16f8..fd1cc811063 100755 --- a/src/app/components/dropdown/dropdown.ts +++ b/src/app/components/dropdown/dropdown.ts @@ -152,7 +152,7 @@ export class DropdownItem { {{ label() === 'p-emptylabel' ? ' ' : label() }} - {{ label() === 'p-emptylabel' ? ' ' : placeholder() }} + {{ label() === 'p-emptylabel' ? ' ' : placeholder() }} this.hide(true), 1); preventChange === false && this.onChange.emit({ originalEvent: event, value: value }); } - isHide && setTimeout(() => this.hide(true), 1); } onOptionMouseEnter(event, index) { @@ -1184,7 +1188,11 @@ export class Dropdown implements OnInit, AfterViewInit, AfterContentInit, AfterV } isOptionDisabled(option: any) { - return this.optionDisabled ? ObjectUtils.resolveFieldData(option, this.optionDisabled) : option && option.disabled !== undefined ? option.disabled : false; + if (this.getOptionValue(this.modelValue()) === this.getOptionValue(option) || (this.getOptionLabel(this.modelValue() === this.getOptionLabel(option)) && option.disabled === false)) { + return false; + } else { + return this.optionDisabled ? ObjectUtils.resolveFieldData(option, this.optionDisabled) : option && option.disabled !== undefined ? option.disabled : false; + } } getOptionGroupLabel(optionGroup: any) {