Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82276

Stop delete action in server-side preRemove

$
0
0

Hello,

Is there any way to stop deletion by catching server-side preRemove event and change it to something else?

->on( 'preRemove', function ( $editor, $id, $values ) {
    //kill DELETE action and make UPDATE instead
} )

I am looking for soft delete solution. The one that I have found on forum is great: https://datatables.net/forums/discussion/31310/possible-to-soft-delete

but the problem with it is that it changes remove to edit action and I've got some custom sql() in

->on( 'postEdit', function ( $editor, $id, $values, $row ) {
     $editor->db()->sql('CUSTOM QUERY BASED ON $row DATA');
})

so in that case I receive sql errors (because some fields are empty). Of course I can make some if's that search for empty data so code could assume that this is not a real edit but soft-deletion but maybe there is a nicer way?


Viewing all articles
Browse latest Browse all 82276

Trending Articles