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

Dropdown value is not cleared when options change #8806

Closed
dmytro-gokun opened this issue Apr 30, 2020 · 3 comments
Closed

Dropdown value is not cleared when options change #8806

dmytro-gokun opened this issue Apr 30, 2020 · 3 comments
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@dmytro-gokun
Copy link

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting

Plunkr Case (Bug Reports)
https://stackblitz.com/edit/primeng-dropdown-options-changed-value-not-cleared

Current behavior
If a dropdown has a selected item and it's options change so that selected item is not longer present, the dropdown keeps previous value and "clear" button is not hidden:

image

Expected behavior
The dropdown value has to be cleared (with "change" event fired) and "clear" button hidden.

  • Angular version: 9.1.1
  • PrimeNG version: 9.0.6
@dheeraj237
Copy link

This should be handled in dropdown module itself when we change option list, selectedItem should re initialize or set to null so that ngModel changes to new value.
You can still this.selectedCity = null; in your onClick() event when setting new options list for workaround.

@dmytro-gokun
Copy link
Author

The problem still exists in 9.1.0

@yigitfindikli yigitfindikli self-assigned this Nov 23, 2020
@yigitfindikli yigitfindikli added the Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add label Nov 23, 2020
@yigitfindikli yigitfindikli added this to the 11.0.1 milestone Nov 23, 2020
@yigitfindikli yigitfindikli modified the milestones: 11.0.0-Final, 11.0.1 Dec 7, 2020
@yigitfindikli yigitfindikli modified the milestones: 11.1.0, 11.2.0 Jan 11, 2021
@yigitfindikli yigitfindikli modified the milestones: 11.2.0, 11.3.0 Jan 21, 2021
@yigitfindikli yigitfindikli modified the milestones: 11.3.0-Final, 11.3.1, 11.3.2 Mar 9, 2021
@yigitfindikli yigitfindikli modified the milestones: 11.3.2, 11.3.3 Apr 5, 2021
@yigitfindikli yigitfindikli modified the milestones: 11.4.0, 11.4.1 Apr 22, 2021
@yigitfindikli yigitfindikli modified the milestones: 11.4.1, 12.Future May 11, 2021
@yigitfindikli yigitfindikli modified the milestones: 13.Future, 13.4.0 May 6, 2022
@yigitfindikli
Copy link
Contributor

Fixed in ed3b308

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants