-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dropdown option fix #14080
Dropdown option fix #14080
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
Now, if you include optionValue the dropdown not work, i select any option and this response blank. |
I think we just need to check for an optionValue and use the selectedOptionIndex, otherwise it'll try and resolve the label just from the value? e.g. label = computed(() => {
let selectedOptionIndex;
this.autoDisplayFirst ? (!this.modelValue() ? (selectedOptionIndex = -1) : (selectedOptionIndex = this.findFirstOptionIndex())) : (selectedOptionIndex = this.findSelectedOptionIndex());
return this.modelValue() && !this.optionValue ? this.getOptionLabel(this.modelValue()) : selectedOptionIndex !== -1 ? this.getOptionLabel(this.visibleOptions()[selectedOptionIndex]) : this.placeholder || 'p-emptylabel';
}); |
@rosenthalj can you make single commit for a single issue |
Hi, Related code piece is refactored and the mentioned issue is fixed by the Core Team, thanks a lot for the effort and support! Closing the PR |
Fixes #14055
Fixes #14054
The pull request changes to dropdown.ts are slightly different then the changes I proposed in issue, I added logic for placeHolder:
&& !this.placeholder
The first video shows this pull request fixes the reproducer provided for issue #14055
DropdownTableFilterFix.mov
The second video shows this pull request fixes the reproducer provided for issue #14054. Note to be consistent with the "demo" reactive form example, I added '[autoDisplayFirst]="false"' to the reproducer html
DropdownOptionFix.mov
I have also tested the code changes with the PrimeNG dropdown demos. They appear to work properly. Note: I had to update two demo files because of missing attributes?