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

p-multiselect is not resetting when using with reactive form #14490

Closed
Cretesh-Anuj opened this issue Jan 5, 2024 · 2 comments
Closed

p-multiselect is not resetting when using with reactive form #14490

Cretesh-Anuj opened this issue Jan 5, 2024 · 2 comments
Assignees
Labels
LTS-16-PORTABLE Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@Cretesh-Anuj
Copy link

Describe the bug

P-multiselect is not going back to its default label even after resetting it when using reactive form

Environment

Latest Angular + PrimeNg, easily reproducible (see the StackBlitz link below)

Step 1 :
MicrosoftTeams-image

Step 2:

23e4af63-b033-446c-bde5-37d63573016a

Step 3:
The checkboxes are unchecked but label is still present with those values.

7084ce1c-784a-46dc-9eff-d17de8b5f2c0

Reproducer

https://stackblitz.com/edit/swzu6g?file=src%2Fapp%2Fdemo%2Fmulti-select-template-demo.ts

Angular version

17.0.8

PrimeNG version

17.3.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

20.9.0

Browser(s)

Chrome

Steps to reproduce the behavior

  1. Select values from multiselect dropdown
  2. Click on reset button
  3. Checkbox is getting unchecked but it is not reflecting multiselect label (i.e. it is not going back to its default label or placeholder)

Expected behavior

  1. Select values from multiselect dropdown
  2. Click on reset button
  3. Checkbox should be unchecked and it should be back to default label or placeholder
@Cretesh-Anuj Cretesh-Anuj added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 5, 2024
@chetanbavare
Copy link

this.trcPatientEngagementForm.get('selectedCountries').setValue([]);
add this line inside ResetForm() function to set the selected countries array to null after clicking reset button

@cetincakiroglu cetincakiroglu added this to the 17.3.2 milestone Jan 8, 2024
@cetincakiroglu cetincakiroglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jan 8, 2024
@yassine-fy94
Copy link

add [showClear]="true" on your html p-multiSelect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTS-16-PORTABLE Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants