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
No description
K
kapa.ai411d ago
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).
const { tableProps, sorter } = useTable<IUser>({
resource: "movies",
metaData: {
select: "*, categories!inner(name)",
},
});
const { tableProps, sorter } = useTable<IUser>({
resource: "movies",
metaData: {
select: "*, categories!inner(name)",
},
});
I hope this helps! ----------------------
K
kapa.ai411d ago
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: