-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Component: p-autocomplete wrong display of chip if multiple=true and optionValue and optionLabel is set #15495
Comments
How can i see the code you wrote in this link? |
Sorry, I copied the applicaton url. Here you can see the code: https://stackblitz.com/edit/github-7hs33e-zqqhbr?file=README.md |
Encountered a similar issue after upgrading from version 17.13.0 to 17.17.0. Also felt like the newly introduced Potential workaroundLet me start with how I was able to eliminate the problem, as that might already help those encountering the same issue. We did not have a value assigned for Added:
to the p-autoComplete, with optionValueFn being initialised as:
That solved it for us. Curious whether that can also somehow help you out of a jam, @lorenyaSICKAG. Short explanation
Towards potential causeWhat most probably ís relevant, as already mentioned, is that it feels like the introduction of When not passing any value to the newly introduced Note The component seems to fallback to Illustration of the unexpected behaviourOn selection of an option, with v17.13.0, the form control value used to get updated from
to
With v17.17.0 the same code initialises the value as before:
But on selection of an additional option, the form control value now becomes:
So this illustrates that at first sight is seems to update the value based on When removing an option it gets worse, the latter assumption seems to get applied to all initialised values as well, e.g. when removing the second option, the value becomes:
|
I'm getting issue with the ngmodel not returning model, instead it return string. still, this need to be fixed |
Problem still exists, it just behaves a little bit different now. In my opinion it is wrong to rely on the suggestions, but store the complete selected object somewhere in the component. Still workaround is to use the So still cannot use PrimeNG Version: 17.18.7 |
The problem still persists. I found a temporary solution;
|
Hi, So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation and try the latest PrimeNG version(v19). If there is no improvement on this, can you open a new issue so we can include it in our roadmap? Thanks a lot for your understanding! |
Describe the bug
We've got an p-autocomplete component where we have set
multiple = true
. And we have set the new optionoptionValue
as well asoptionLabel
. When selecting an option, the created chip is empty.Environment
Simple autocomplete component within an reactive angular form with other autocomplete fields which are working correctly when using
multiple = false
or without an setoptionValue
.Reproducer
Stackblitz here
Angular version
17.3.7
PrimeNG version
17.16.0
Build / Runtime
Angular CLI App
Language
TypeScript
Node version (for AoT issues node --version)
18.14.2
Browser(s)
Chrome
Steps to reproduce the behavior
No response
Expected behavior
Displaying the value of the objects' property defined in
optionLabel
within the chip .The text was updated successfully, but these errors were encountered: