R
Refine
B
Refine
•
4y ago
broad-salmon
when modal close button is pressed form data is not getting cleared
when modal close button is pressed form data is not getting cleared in antd form
Refine
Join
6,201
Members
View on Discord
Was this page helpful?
Yes
No
when modal close button is pressed form data is not getting cleared - Refine
B
broad-salmon
OP
•
12/14/22, 8:29 AM
form fields are not getting cleared
S
skinny-azure
•
12/14/22, 8:33 AM
Hey
@rehan1 you can try
Modal
Modal
component in
destroyOnClose
destroyOnClose
prop
.
S
skinny-azure
•
12/14/22, 8:33 AM
https://ant.design/components/modal#api
Modal - Ant Design
B
broad-salmon
OP
•
12/14/22, 8:36 AM
<Modal title
=
"Add Designations
"
width
=
{500
}
destroyOnClose
=
{true
}
>
B
broad-salmon
OP
•
12/14/22, 8:37 AM
but its not clearing data
S
skinny-azure
•
12/14/22, 8:43 AM
I
'm posting a sample project
. You can do it here
.
S
skinny-azure
•
12/14/22, 8:43 AM
https://stackblitz.com/edit/refinedev-refine-nqnuz9?file=src/pages/posts/list.tsx
Refine Use Modal Example (forked) - StackBlitz
Run official live example code for Refine Use Modal
, created by Refinedev on StackBlitz
S
skinny-azure
•
12/14/22, 8:44 AM
Are you using Antd as UI
?
@rehan1
B
broad-salmon
OP
•
12/14/22, 8:45 AM
i tried using onCancel prop in that i have to resetFields
.
.
.
. this is working
Modal
Modal
destroyOnClose
destroyOnClose