Apply form to multiple parent ids
I have an api where I have a list of some items, and each item has other sublists, in this case some controls.
I need to create a form that shows the controls data for a selected item, and when the user clicks apply it opens a dialog that shows the changes, and most importantly it should have the option to select which items to apply the changes to (current item will be selected by default).
How can I achieve that? I'm using Ant Design for ui.
2 Replies
Hi @Stormlight. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To achieve what you're describing with refine and Ant Design, you can use a combination of
useForm
and useModalForm
hooks along with Ant Design components. Here's a high-level approach to implement this functionality:
1. Use useForm
to create the main form for editing controls of a selected item.
2. Use useModalForm
to create a modal dialog for applying changes to multiple items.
3. Implement a custom "Apply" button that opens the modal with the changes and item selection.
Here's a basic example of how you might structure this:
This example provides a basic structure for what you're trying to achieve. You'll need to adapt it to your specific API and data structure. The useForm
hook manages the main form for editing controls, while useModalForm
handles the modal for applying changes to multiple items.
For more detailed information on using these hooks, you can refer to the following refine documentation:
- useForm Hook Documentation
- useModalForm Hook Documentation
These resources will provide you with more specific examples and options for customizing the behavior to fit your exact requirements.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@453354981907759115> Kapa.ai is still learning and improving, please let me know how I did by reacting below.