When you build a custom section (or tree) in the backend, and
have a delete action on your nodes, you don't want the right-hand
frame to stay on the deleted object after a delete. The user may be
tempted to click save, and unless you're prepared for that, things
will go sideways.
So, you want to return to your dashboard (or the default - empty
- page) after deleting the node.
Umbraco itself doesn't handle this in all places, but after
diving deep into the umbraco javascript source, I found a hack that
works.
In your BaseTree implementation, in the RenderJS override, add
this javascript snippet:
function toxicOnDeleted(EV)
{
UmbClientMgr.appActions().openDashboard('toxic');
}
UmbClientMgr.appActions()
.addEventHandler('nodeDeleted', function(E) { toxicOnDeleted(E); } );
I have several trees in my section and i only run this in ONE of
them (it will fire for any node in any tree in the section).
I'm not entirely sure if I should find some way to unregister
the eventhandler (or protect it from being registered more than
once), but in any case, it works for now.
Any other solutions - or additional thoughts - out there?
EDIT: I tried to figure out a way to see which node had been
deleted, but ran out of time. It seems that the event argument
doesn't contain anything useful, but the node id or alias may be
available elsewhere. If anyone has any intel on this, please let me
know.