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

Multiselect: reset form doesn't clear the field #14937

Closed
aboudard opened this issue Mar 4, 2024 · 1 comment
Closed

Multiselect: reset form doesn't clear the field #14937

aboudard opened this issue Mar 4, 2024 · 1 comment
Labels
Resolution: Invalid Issue or pull request is not valid in the latest version

Comments

@aboudard
Copy link

aboudard commented Mar 4, 2024

Describe the bug

When using the Multiselect PrimeNg component, with a custom pTemplate="selectedItems" if you want to reset the form, the value of the field is cleared, but the options remain even if they don't appear, they still are present in the component as selectedOptions. When using Array of string instead of Array of objects as the data of the Multiselect, the field doesn't get cleared, and values still show up.
The form is a Reactive Form.
When you get the Multiselect elements and clear the selectedOptions programatically, the fields get cleared as expected.
Selecting values :
image
Reset ko :
image
Reset ok :
image

Environment

Regular Angular CLI project with Angular 16 and PrimeNg 16, primeflex.

Reproducer

https://stackblitz.com/edit/primeng-dropdown-demo-gjw8xm

Angular version

16.2.12

PrimeNG version

16.9.1

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

16+

Browser(s)

Chrome 122

Steps to reproduce the behavior

In the Stackblitz :

  • Select values for the 3 multiselect.
  • Click on the button reset ko
  • The first field had the length of his previous selection, the second field still shows values, the third field is ok
  • Select values for the 3 multiselect
  • Click on the button reset ok
  • All fields are cleared

DOM inspection on the first field :
image

Expected behavior

On FormGroup reset, the fields should both be cleared of value, but also of display.

@aboudard aboudard added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Mar 4, 2024
@mehmetcetin01140 mehmetcetin01140 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 May 14, 2024
@mehmetcetin01140 mehmetcetin01140 added this to the 17.16.2 milestone May 14, 2024
@mehmetcetin01140
Copy link
Contributor

Hi,

Thanks for reporting the issue.
This issue has been fixed between your version and v17.16.1, please use the latest version to get the updates.

Example with 17.16.1: https://stackblitz.com/edit/ayjjym?file=src%2Fapp%2Fmulti-select-basic-demo.ts

Closing the issue.

@mehmetcetin01140 mehmetcetin01140 added Resolution: Invalid Issue or pull request is not valid in the latest version and removed Type: Bug Issue contains a bug related to a specific component. Something about the component is not working labels May 16, 2024
@cetincakiroglu cetincakiroglu removed this from the 17.16.2 milestone May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Invalid Issue or pull request is not valid in the latest version
Projects
None yet
Development

No branches or pull requests

3 participants