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

dropdown: selected, disabled option not rendered when using selectedItem template #14809

Closed
capc0 opened this issue Feb 14, 2024 · 3 comments
Closed
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@capc0
Copy link
Contributor

capc0 commented Feb 14, 2024

Describe the bug

Same as #14716 but only when using a template to render the dropdown differently:

<ng-template let-item pTemplate="selectedItem">
    {{ item }}
  </ng-template>

Environment

see below

Reproducer

https://stackblitz.com/edit/github-npixcr-zf149n?file=src%2Fapp%2Fapp.component.html

Angular version

17.1.2

PrimeNG version

17.7.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18

Browser(s)

No response

Steps to reproduce the behavior

open the stackblitz (see above)

image

Expected behavior

The selected item should be rendered

@capc0 capc0 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Feb 14, 2024
@rosenthalj
Copy link
Contributor

This issue is the result of the PrimeNG's dropdown.ts passes selectedOption to the "selectedItem" template, but disabled options are currently not allowed to be the selectedOption.

See the annotated screenshot of your reproducer listed below:

Primefaces_-Primeng_Issue_Template__forked_-StackBlitz_and_dropdown__selected__disabled_option_not_rendered_when_using_selectedItem_template·Issue__14809·_primefaces_primeng

If PrimeNG is changed to allow the selectedOption to be set to a disabled option, the following is an untested fix to dropdown.ts:

primeng_src_app_components_dropdown_dropdown_ts_at_master_·_primefaces_primeng

@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 Feb 16, 2024
@cetincakiroglu cetincakiroglu added this to the 17.8.0 milestone Feb 22, 2024
@thetric
Copy link

thetric commented Feb 22, 2024

This was working in 17.4.0 but broke in 17.5.0 due to the refactoring introduced in #13991

@cetincakiroglu
Copy link
Contributor

Hi,

Thanks for reporting the issue, it's fixed in 24ea912

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

5 participants