On delete, change color (or something) rather than call fnDeleteRow

On delete, change color (or something) rather than call fnDeleteRow

burncharburnchar Posts: 118Questions: 12Answers: 0
edited August 2012 in Editor
I'm writing an application which requires approvals for all edits. As such, deletes should be marked as "delete me" rather than deleted immediately, as is the default of Editor.

The following thread briefly discusses color changes in response to an edit:
http://datatables.net/forums/discussion/1000/change-text-color-after-edit-a-cell/

I notice that DataTables 1.7+ includes an option for fnDeleteRow to not redraw the table, but that doesn't seem appropriate both because I don't know how to intercept said call to add that third parameter and because some other action may redraw the table later. Ideally I'd liked the "delete" action to send the delete request as normal to the server, but change the row background to red (etc.) for the user.

How do I prevent a row deletion from visibly deleting the row so that I have something whose color can be changed?

Replies

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin
    Hi,

    I think there are a couple of ways that this could be approached.

    Firstly on the server-side you could intercept the 'delete' action submitted by Editor and simply update the table with the delete flag instead of actually deleting it. Editor will still remove the row on the client-side - but you will need to apply a filter to the table on load to not include rows which are marked for deletion (an admin table could then be used to approve the delete command).

    Or on the client-side you could have Editor not sending a delete command, but rather another update, but with the flag to mark for deletion show. They you would show in the table which rows are marked for deletion, which from your last paragraph I think is more what you would want.

    Allan
This discussion has been closed.