Skip to content
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

fix(14715): selecting a falsy value (such as '0' or 0) should not show placeholder #14719

Conversation

Cr3aHal0
Copy link
Contributor

@Cr3aHal0 Cr3aHal0 commented Feb 5, 2024

Fixes #14715

Not sure if this is by design or if a larger set of value should or should not be accepted (such as true/false), feel free to reject this PR. I did hesitate to use ObjectUtils.isNotEmpty but since it excludes an empty string as being an authorized option, I thought it may be too much.

Copy link

vercel bot commented Feb 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
primeng ⬜️ Ignored (Inspect) Visit Preview Feb 6, 2024 9:55pm

…w placeholder (especially when such option has a label)
@Cr3aHal0 Cr3aHal0 force-pushed the feature/14715-option-falsy-value-showing-placeholder-rather-than-option-label branch from a0ada3d to caeae32 Compare February 6, 2024 08:22
@rosenthalj
Copy link
Contributor

rosenthalj commented Feb 6, 2024

I believe this pull request is not complete. This pull request is an attempt to fix a condition that I did not consider when the code was changed for pull request #14665. Was this pull requested fully tested with a value of 0 and using the dropdown's filtering?

Please see the annotated screenshot of pull request #14665 listed below

Fix__14596_-fixes_p-dropdown_logic_for_selectedOption_and_label_by_rosenthalj·Pull_Request__14665·_primefaces_primeng

…lue to have its label displayed + strict type check
@Cr3aHal0
Copy link
Contributor Author

Cr3aHal0 commented Feb 6, 2024

rosenthalj

You may find in latest commit some more changes (including the one you mentioned) about strict type check of modelValue(). I did test it against the filterable dropdown use case and it works well, both from filter and from ngModel initialization. I tweaked a bit the template of the filter example to get rid of the unnecessary selectionCountry check since the template is bound only if the dropdown as a valid value.

Let me know if this sounds good to you

@cetincakiroglu cetincakiroglu merged commit b7aecd7 into primefaces:master Feb 7, 2024
3 checks passed
cetincakiroglu added a commit that referenced this pull request Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dropdown: "0" Value in optionValue, causes Label to be replaced by Placeholder
3 participants