Please check the screenshots. I am trying to access user's first name from my customers collection which is stored in Users collections. Customers have data related to them while Users collection hold general information like first name, email etc.
#Why can't i access relationship fields from my admin UI list view and defaultColumns?
10 messages · Page 1 of 1 (latest)
Help is on the way! To mark it as solved, use the /solve command. In the meantime, here are some existing threads that may help you:
Documentation:
- Relationship Field - Admin Options
- Relationship Field - How the data is saved - Querying and Filtering Polymorphic Relationships
- Join Field - Using the Join field to have full control of your database schema - Specifying additional fields on relationships
Community-Help:
You'll need to create a virtual, root-level field that mirrors the data from that nested field, that you'll be able to use for useAsTitle.
So I need to recreate virtual fields in my Customers collection for all the fields in my Users collection? What's the point of relationships then? This is very inconvenient.
For the field that you want to use as title
I want to display firstName, lastName, avatar, and a bunch of other fields from my Users collection in my Customers collection view in the admin panel. I can never access to customer.user.firstName, or avatar fields?
You can only use top-level fields in your config as a useAsTitle. As others have mentioned, you could use a "compound" field which gets populated via some hook like beforeChange. If you want to show this much data on every entry in your list view, then you should use a custom cell component for this compound field.
You were asking about useAsTitle before. Now you're asking something different. If you want to display relations in another way than the default you need to create a custom component
Thank you. Does the custom component need to be client or server?
Can be both