`postRemove` after `preRemove` inconsistency
`postRemove` after `preRemove` inconsistency
In Editor.php
in the function _remove
, there is the following problem:
- When all registrations return false
from preRemove
, no postRemove
callback is fired
- When at least one registration returns something different from false
, the postRemove
callback is fired for all submitted rows.
I currently use the preRemove
and postRemove
event together to:
- do soft delete in preRemove
, ie change deleted
bit in row
- renumbering of sequence numbers in postRemove
, so that the rowReorder column still has the right numbers
- the client obtains these values by updating the table after the remove has succeeded, but another option would be to submit the seq
values of the remaining rows and have the client update the table in the postRemove
(javascript) event.
Two issues:
1. all preRemove
callbacks return false, and hence no postRemove
callback will be fired.
2. the soft-deleted rows will be added to the cancelled
array, but the rows are cancelled, just not by the editor code.
Solutions:
1. Have preRemove
return two different values, indicating 'do not delete this record' and 'I deleted the record'
2. Always call the postRemove
callback for all rows, or maybe just for the deleted rows (ie, those that were removed by editor or whose preRemove
returned 'I deleted the record')