some deletion questions

some deletion questions

unfathomedxinunfathomedxin Posts: 5Questions: 3Answers: 0

Hi, Im wondering if its possible to modify the delete button

my table1 displays like this https://editor.datatables.net/examples/inline-editing/columns.html
my table2 displays the list of office connected to that table
when i click delete on table2 it should delete all data relating to that office
for example deleting office on london will delete all people that works in london

is this possible?

Answers

  • allanallan Posts: 61,892Questions: 1Answers: 10,144 Site admin

    I would suggest using a postRemove server-side event for this. It isn't something that I would generally recommend doing on the client-side this - I think this is server-side logic.

    Use postRemove to know when a row has been removed and then you can perform whatever additional action you need, including deleting rows from other tables. You may need to use preRemove depending on how your database is configured.

    Another option, depending on your database, is to use ON DELETE CASCADE which would mean that you don't need any other logic in the PHP as the database will delete the rows for you.

    Allan

This discussion has been closed.