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

Listbox default values being set. #14041

Closed
hollowthought opened this issue Nov 6, 2023 · 1 comment
Closed

Listbox default values being set. #14041

hollowthought opened this issue Nov 6, 2023 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@hollowthought
Copy link

hollowthought commented Nov 6, 2023

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

@hollowthought hollowthought 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 6, 2023
@cetincakiroglu cetincakiroglu added this to the 16.8.0 milestone Nov 16, 2023
@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 16, 2023
@cetincakiroglu cetincakiroglu self-assigned this Nov 16, 2023
@cetincakiroglu
Copy link
Contributor

Thanks for reporting the issue!

cetincakiroglu added a commit that referenced this issue Nov 16, 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

2 participants