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

p-dropdown: Selected value is changed properly, but colors are not updated in the following example #14457

Closed
AIO1 opened this issue Jan 1, 2024 · 4 comments
Labels
Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response Type: Bug Issue contains a bug related to a specific component. Something about the component is not working

Comments

@AIO1
Copy link

AIO1 commented Jan 1, 2024

Describe the bug

Given the following TypeScript code:

  dropdown_energyEfficiency: IEnergyEfficiency[] = [];
  dropdown_SelectedEnergyEfficiency: IEnergyEfficiency | null = null;

interface IEnergyEfficiency {
  id: string;
  energyLetter: string;
  colorR: number;
  colorG: number;
  colorB: number;
}

And given the following HTML code:

                                <div class="flex-grow-1">
                                    <div class="flex flex-column gap-2">
                                        <label for="squareMeter" style="font-weight: bold;">Eficiencia energética</label>
                                        <p-dropdown appendTo="body" [showClear]="true" [style]="{'width': '100%'}" [options]="dropdown_energyEfficiency" [(ngModel)]="dropdown_SelectedEnergyEfficiency" placeholder="Selecciona una eficiencia energética">
                                            <ng-template pTemplate="selectedItem">
                                                <div *ngIf="dropdown_SelectedEnergyEfficiency">
                                                    <p-tag [style]="{ 'background': 'rgb(' + dropdown_SelectedEnergyEfficiency.colorR + ',' + dropdown_SelectedEnergyEfficiency.colorG + ',' + dropdown_SelectedEnergyEfficiency.colorB + ')'}">
                                                        <div class="flex align-items-center gap-2">
                                                            <span class="text-base">{{ dropdown_SelectedEnergyEfficiency.energyLetter }}</span>
                                                        </div>
                                                    </p-tag>
                                                </div>
                                            </ng-template>
                                            <ng-template let-curItem pTemplate="item">
                                                <div class="flex align-items-center gap-2">
                                                    <p-tag [style]="{ 'background': 'rgb(' + curItem.colorR + ',' + curItem.colorG + ',' + curItem.colorB + ')'}">
                                                        <div class="flex align-items-center gap-2">
                                                            <span class="text-base">{{ curItem.energyLetter }}</span>
                                                        </div>
                                                    </p-tag>
                                                </div>
                                            </ng-template>
                                        </p-dropdown>
                                    </div>
                                </div>

Fllow these steps in order to reproduce the error:

  1. Open the dropdown to view the options available:
    image

  2. Select one option, for example "G". It works as intended.
    image

  3. Pick now letter "A" and see that the color is not updated.
    image

  4. Click on the dropdown "X" icon and select again letter "A", now it works.
    image

The tag will be properly updated in frist select, but subsequent selects (unless dropdown is set to null) won't update the color of the tag.

Environment

Development

Reproducer

No response

Angular version

17

PrimeNG version

17.3.0

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

v20.10.0

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@AIO1 AIO1 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 1, 2024
@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 Jan 5, 2024
Copy link

github-actions bot commented May 5, 2024

This issue has been automatically marked as stale. If this issue is still affecting you with the latest version, please leave any comment, and we will keep it open. We are sorry that we have not been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@github-actions github-actions bot added the Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response label May 5, 2024
@AIO1
Copy link
Author

AIO1 commented May 5, 2024

It's still active.

@github-actions github-actions bot removed the Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response label May 6, 2024
Copy link

github-actions bot commented Sep 3, 2024

This issue has been automatically marked as stale. If this issue is still affecting you with the latest version, please leave any comment, and we will keep it open. We are sorry that we have not been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@github-actions github-actions bot added the Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response label Sep 3, 2024
Copy link

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you for your understanding!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Stale Issue or pull request is inactivity and unfortunately it will be *closed* if there is no response 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