Hi! Currently i'm building a website that's need a virtual field that is visible and not editable to user (There is a way to do that on payload website)
However, it's a calculated field that's need to fetch the data from another collection. Good example is product item inside order.
Is there a way to display the subtotal in each array box and the grand total outside the block while the admin is creating order? Thank you
#Suggestion on how to build order creating?
15 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:
You should probably use a custom component here https://payloadcms.com/docs/beta/admin/fields#the-field-component
See this slug field for inspiration (v3) https://github.com/payloadcms/payload/blob/beta/templates/website/src/fields/slug/SlugComponent.tsx
You can essentially listen in on data from other fields, do whatever you need and display it as needed
Thank you so much! I will try it tomorrow.
if I want to change the component dynamically I would have to use react client instead of server? Right since the field component will be render in the server not dynamically?
yep
you can also write a server component that returns a client if you need to pass down some logic to it
you cant use the local API in the client server so there you need to use the rest api
as in your slug field it is using client component right? In my case where you need to listen to data input as you choose (relationship) is it much better to use client component or server component?
Thank you so much!
Glad your issue was resolved! :tada: If you want to help make payload better, please give us a :star: on GitHub and review us - It helps us a lot.
🌟 Star Us on GitHub
👍 Review Us