From fd154d8049ebf52b644fd846ecfa512620c78fd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87etin?= <69278826+cetincakiroglu@users.noreply.github.com> Date: Thu, 5 May 2022 17:14:27 +0300 Subject: [PATCH] Fixed #11485 - Dropdown | auto-selects group entries instead of first entry inside first group --- src/app/components/dropdown/dropdown.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/components/dropdown/dropdown.ts b/src/app/components/dropdown/dropdown.ts index 7480ac90f51..faa0843d059 100755 --- a/src/app/components/dropdown/dropdown.ts +++ b/src/app/components/dropdown/dropdown.ts @@ -596,7 +596,11 @@ export class Dropdown implements OnInit,AfterViewInit,AfterContentInit,AfterView this.selectedOption = this.findOption(val, this.optionsToDisplay); if (this.autoDisplayFirst && !this.placeholder && !this.selectedOption && this.optionsToDisplay && this.optionsToDisplay.length && !this.editable) { - this.selectedOption = this.optionsToDisplay[0]; + if(this.group) { + this.selectedOption = this.optionsToDisplay[0].items[0]; + } else { + this.selectedOption = this.optionsToDisplay[0]; + } this.value = this.getOptionValue(this.selectedOption); this.onModelChange(this.value); }