primefaces / community

Community Forum
0 stars 0 forks source link

optionValue of p-dropdown is not properly working #482

Closed SpiderPork closed 7 months ago

SpiderPork commented 7 months ago

Discussed in https://github.com/orgs/primefaces/discussions/421

Originally posted by **BrayanDevM** November 8, 2023 # The issue The `optionValue` of the component is not working correctly. I performed a version migration from PrimeNG 15 to *16.7.2*, and immediately the dropdowns that receive an object but have their value and label specified stopped working. They are displayed correctly, but when selecting an option, the dropdown remains empty, and in the HTML, the value "empty" appears. ![image](https://github.com/primefaces/community/assets/20876438/b6c1b4b0-245e-432d-a799-b45868be5129) # Code ``` form = this.fb.nonNullable.group({ identificationTypeId: [1, [Validators.required]], identification: ['', [Validators.required, Validators.pattern(/^[0-9]*$/)]] }); identificationTypeList = [ { id: 1, shortName: 'CC', description: 'Cedula de ciudadania' }, { id: 2, shortName: 'CE', description: 'Cedula de extranjeria' } ]; ``` ``` ```


This is a testcase showing the problem:

https://stackblitz.com/edit/rxgqkz?file=src%2Fapp%2Fdemo%2Fdropdown-basic-demo.ts

FlipWarthog commented 7 months ago

@SpiderPork When issues are created from community discussion items, they're not put in the correct tracker. Can you please recreate this issue under https://github.com/primefaces/primeng/issues and close this one?

SpiderPork commented 7 months ago

@SpiderPork When issues are created from community discussion items, they're not put in the correct tracker. Can you please recreate this issue under https://github.com/primefaces/primeng/issues and close this one?

Sorry for mistake. Done.

FlipWarthog commented 7 months ago

@SpiderPork Not a problem at all and not the first. Thanks!