Nested
I am trying to add nested resources, List inside Show (for one-to-many) also have a create in list using drawerform, but drawer form is catching the context of show not the List
27 Replies
Hey @bhk2988 ,
Sorry, I don't fully understand. Can you give some example?
fair-rose•3y ago
fair-rose•3y ago
I am creating something like this
DIstribution -> has many versions
I wan to add version to that distribution directly from here
But when I click on create
fair-rose•3y ago
fair-rose•3y ago
It is showing Distribution and not version
You can use "resource" and "action" properties of useDrawerForm and can access active distribution id from id property of useShow
As in this example, you can add the distributionId to your form data by overrriding the onFinish property of useDrawerForm. https://refine.dev/docs/guides-and-concepts/upload/base64-upload/
Base64 Upload | refine
By encoding your files and images from your forms to Base64 you can change all files needed for the upload to Base64 format before the submit. This can be done via the onFinish property of the `` component that comes with Ant Design
Also you can override Create component' resource, title, etc properties.
https://refine.dev/docs/ui-frameworks/antd/components/basic-views/create/#resource
Create | refine
`` provides us a layout to display the page. It does not contain any logic but adds extra functionalities like action buttons and giving titles to the page.
fair-rose•3y ago
I have passed resource to create
fair-rose•3y ago
But it still showing clone their
I hv managed to remove it by setting tags property of page header to empty array but still this should be the default behavior?
Uhmm looks like a bug. Could you create a issue?
fair-rose•3y ago
Sure
Also can u tell how we can manage redirect ?
as there is no page component for this
You can use useNavigation hooks
useNavigation | refine
refine uses routerProvider and comes with all redirects out of the box. It allows you to manage your routing operations in refine. Using this hook, you can manage all the routing operations of your application very easily.
fair-rose•3y ago
After form is submited API is hit and its redirected to "list" of the resource by default but what if I want to stop the redirection
You can set the redirect parameter of useForm as "false"
fair-rose•3y ago
I am using useDrawerForm it doesn't have "false"
fair-rose•3y ago
useDrawerForm | refine
useDrawerForm hook allows you to manage a form within a Drawer. It returns Ant Design Form and Drawer components props.
fair-rose•3y ago
redirect has only show edit list
hmm i guess it was forgotten 🙂 Thanks for your attention. Do you want to update the document? or can we update it?
You can see it in its version in "core",
https://refine.dev/docs/core/hooks/useForm/#properties
fair-rose•3y ago
It's also absent in the type defination
Will raise a pull request for this
Thank you @bhk2988 🚀
fair-rose•3y ago
GitHub
docs: added false type to redirect property of usedrawerform, usemo...
Added missing false type to redirect property of useDrawerForm, useModalForm, useStepsForm.
Wow thank you!
Could you update on v3 docs too?
fair-rose•3y ago
Is there any way we can hook on success?
Caz I want to re fetch data after adding
Yes, you can use "onMutationSuccess"