How to Delete Table that Contains many to many relation?
Hello everyone, I am using next.js, mantine, and supabase db. But, i have a problem with delete the many to many relation on table delete button. The table provide column like this image above/below and i am looking the props that will manipulate my onClick with handle function contain code for delete my many to many relation. Is there any solution for this problem? or i should build custom button? Thanks in advance
2 Replies
Hey @dihza! I'm the kapa.ai support bot. I've searched through the docs to try to answer your question. :wave:
----------------------
It looks like you are trying to delete a table that contains a many-to-many relationship. Refine provides a
DeleteButton
component that can be used to delete a record from a table. You can add the DeleteButton
to the Actions
column of your table, as described in the blog post (https://refine.dev/blog/react-admin-panel/).
You can also use the metaData
property of the useTable
hook to pass additional data to the data provider when deleting a record. For example, for a movies <-> categories_movies <-> categories
many-to-many relationship, you can use the metaData
property to get the categories
data of a user when deleting a record, as shown in the API Reference (https://refine.dev/docs/advanced-tutorials/data-provider/supabase).
I hope this helps!
----------------------Did kapa.ai help answer your question?
<@373850731054366731> kapa.ai is still learning and improving, please let us how it did by reacting with a :thumbsup: or :thumbsdown: