Possible to soft delete
Possible to soft delete
randy.johnson
Posts: 18Questions: 8Answers: 0
in Editor
Hello,
Is it possible to do a soft delete with the php library?
Thanks!
Randy
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You mean like what Laravel lets you do? Instead of deleting the row, just set the
deleted_on
column to the date, then exclude any rows with that column as populated?I dont believe so, at least not right out of the box.. But you can obviously edit the PHP file to do it. Thats all Open Source.
jLinux is correct - although there isn't a trivial option to do this, it is relatively straight forward to setup a method to do it. The way I would suggest doing it myself is to create a custom button that will use the Editor API (
edit()
,set()
andsubmit()
) to edit the selected rows, setting their delete flag to 1 (or whatever you use to mark a row as deleted) and then submit that to the server.Simply apply a
where
condition to then load only the rows which are not marked as deleted.Allan
The below worked for me.
Using the simple example (https://editor.datatables.net/examples/simple/simple.html) I added the below JS
On the PHP side, I also added the 'deleted' field to the Editor instance. e.g.
Hope that helps someone.