-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Allow to customize default display field per resource (use name instead of id) #4899
Comments
Hi, and thank for your input. So you're using guessers, and you want the ability to customize them. This is not what guessers were designed for. Guessers are here to bootstrap your code. If the default output of a guesser doesn't suit you, you should copy the code written by the guesser in the console, and use it to replace the guesser component by a custom component that you can customize. So we won't implement what you're asking, sorry. |
Fair enough about the Guessers ! But having a default text representation for resources still makes sense outside of Guessers (I'm used to this from the Django framework). It would allow to reduce boiler plate code in a lot of places. It's also more DRY as the day you want to change from ReferenceField before
ReferenceField after
Edit Before
Edit After
|
True, this is convenient. Let's make it an enhancement request. |
Fixed by #8011 |
Is your feature request related to a problem? Please describe.
By default, react-admin uses the
id
field to represent a row (for example as the first column in the list view, as the displayed attribute in ReferenceFields, in the navbar of the edit view, etc.).This behavior range from not very helpful when using integers pks (
Client #3
=> doesn't give much info) to not usable when using uuids (Client #00c8b66f-4f01-4db7-b0c6-ad588c7842ba
=> destroys the layout and looks like a bug).Describe the solution you'd like
I'd love to be able to specify the field to be used to represent the row like this :
(alternative naming ideas instead of
display
:repr
,mainAttribute
,titleAttribute
, ...)Describe alternatives you've considered
Not using Guessers, and creating title componenents for all my resources. This works well, but is verbose, and you loose a bit the out-of-the-box-awesomeness of react-admin.
Additional context
Thanks for react-admin, it's really awesome :-)
The text was updated successfully, but these errors were encountered: