-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
AutoComplete: selectedItemTemplate displays [Object object] #6633
Labels
Type: Bug
Issue contains a defect related to a specific component.
Milestone
Comments
xAl3xFx
added
the
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
label
May 16, 2024
+1 here. This works: So can't apply specific formatting to the selectedItem |
hmmm the code tries to get it as a JSX element. const formatValue = (value) => {
if (ObjectUtils.isNotEmpty(value)) {
if (typeof value === 'string') {
return value;
} else if (props.selectedItemTemplate) {
const resolvedFieldData = ObjectUtils.getJSXElement(props.selectedItemTemplate, value);
return resolvedFieldData ? resolvedFieldData : value;
} else if (props.field) {
const resolvedFieldData = ObjectUtils.resolveFieldData(value, props.field);
return resolvedFieldData !== null && resolvedFieldData !== undefined ? resolvedFieldData : value;
}
return value;
}
return '';
}; |
oh duh i see the issue |
melloware
added a commit
to melloware/primereact
that referenced
this issue
Oct 17, 2024
melloware
added
Type: Bug
Issue contains a defect related to a specific component.
and removed
Status: Needs Triage
Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
labels
Oct 17, 2024
melloware
added a commit
to melloware/primereact
that referenced
this issue
Oct 17, 2024
melloware
added a commit
that referenced
this issue
Oct 17, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Having AutoComplete component with selectedItemTemplate which returns React.Node the displayed value is [Object object]
Reproducer
https://stackblitz.com/edit/k4e3ju?file=src%2FApp.jsx
PrimeReact version
10.6.5
React version
18.x
Language
TypeScript
Build / Runtime
Create React App (CRA)
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: