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 set value error v16.7.0 #13999

Closed
macallejah opened this issue Nov 2, 2023 · 3 comments
Closed

Multiselect set value error v16.7.0 #13999

macallejah opened this issue Nov 2, 2023 · 3 comments
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@macallejah
Copy link

macallejah commented Nov 2, 2023

Describe the bug

I set a value of a multiselect through a form (patchValue), and the value is not set. In version 16.6.0 it works perfectly

Environment

multiselect

Reproducer

No response

Angular version

16.2.9

PrimeNG version

16.7.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.12.1

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

When you set the value to be displayed in the component

Note:
This function (multiselect.ts: 1775) does not take the value of the input. It may be one of the problems

 writeValue(value: any): void {
    this.value = this.modelValue(); 
    this.updateModel(this.value);
    this.checkSelectionLimit();

    this.cd.markForCheck();
}
@macallejah macallejah added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 2, 2023
@ZephyrZiggurat
Copy link

ZephyrZiggurat commented Nov 2, 2023

Our multiselects are not respecting a default list of items that should be pre-selected. They worked perfect in 16.6.0 but not in 16.7.0.

The code that used to work looks similar to this old example (that I no longer see in the docs):

<p-multiSelect [options]="cars" [(ngModel)]="selectedCars">
</p-multiSelect>

cars = [
    {label: 'Audi', value: 'Audi'},
    {label: 'BMW', value: 'BMW'},
    {label: 'Fiat', value: 'Fiat'}
]
selectedCars=[cars[0].value]

@mperezd
Copy link

mperezd commented Nov 2, 2023

Stackblitz example showing patchValue is not working:

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

@cetincakiroglu
Copy link
Contributor

Hi,

Thanks for reporting the issue, we've reworked the input components during the accessibility implementation and this issue is probably related to this process.

@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 Nov 2, 2023
@cetincakiroglu cetincakiroglu self-assigned this Nov 2, 2023
@cetincakiroglu cetincakiroglu added this to the 16.8.0 milestone Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

4 participants