Dropdown: option is empty when it has group property and dropdown has [group]="false" #14304
Labels
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Describe the bug
I'm reopening the following issue #14276 because I think I didn't provide a clear explanation for my problem and the team member misunderstood me.
We're want to update from v16.6.0 to latest version of PrimeNG.
We have models in our app with a
group
property. Currently we using a lot of dropdowns that are using these models as options, some of these dropdowns usinggroup
property as aoptionLabel
oroptionValue
, BUT we don't use grouped options. After updating to latest version dropdowns render these options as empty:It happens because internally PrimeNG decides which template to use based on existence of
group
property:But I think not to break existing behavior this check should be handled the same way as in MultiSelect and Autocomplete components by checking multiple properties:
As I see Dropdown component even has the same function implementation, it should be possible just to replace current check with this function call. For me it seems only logical that if
@Input() group
is set tofalse
then it shouldn't choose group template at all.And to rename all models and their usages or come up with some other solution just to return the previous behavior is far from ideal.
Environment
Any environment
Reproducer
https://stackblitz.com/edit/ee5k5j?file=src%2Fapp%2Fdemo%2Fdropdown-basic-demo.html,src%2Fapp%2Fdemo%2Fdropdown-basic-demo.ts
Angular version
17.0.0
PrimeNG version
17.0.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.18.0
Browser(s)
No response
Steps to reproduce the behavior
group
property to any option.[group]="false"
to Dropdown component.The option is rendered empty even though we're not interested in grouped options.
https://stackblitz.com/edit/ee5k5j?file=src%2Fapp%2Fdemo%2Fdropdown-basic-demo.ts
And here's an example from v16.6.0
https://stackblitz.com/edit/dc7jhu?file=src%2Fapp%2Fdemo%2Fdropdown-basic-demo.ts,package.json
Expected behavior
The items should be rendered OR the docs should warn that group cannot be used as a property.
The text was updated successfully, but these errors were encountered: