Listbox default values being set. #14041
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
I can no longer set a default value for the Listbox. I just had this problem with the dropdowns as well which is now fixed in 16.7.1. After I get the data for the listbox from my server, I set the default value using the model variable. In my case I set it to be the same as the options variable so I would have all of the items in the list checked by default. This works in 16.6.0.
HTML:
<p-listbox [options]="tabs" checkbox="true"
[(ngModel)]="selectedTabs" [multiple]="true" optionLabel="name"
[filter]="filter" [listStyle]="{'max-height':'150px'}"
[style]="{'width':'25rem'}">
Code:
this.tabs = response.SheetNames.map(sheet => {
return { name: sheet }
});
this.selectedTabs = this.tabs;
Environment
Windows
Visual Studio Code
Reproducer
No response
Angular version
16.2.9
PrimeNG version
16.7.1
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
16.17.1
Browser(s)
Chrome
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: