Deleting current document from content tree via API
I
have a situation where I’d like to delete the current document once it meets a
certain condition/state. I’ve triggered this check from the before/after
publish events but im not having any luck with the UI once I’ve deleted it. It
looks like umbraco is trying to update the content tree and/or detail pane
after I’ve deleted it, and because it no longer exists it throws a wobbly.
entryDoc.delete(false);
when
I don’t delete the doument permanently then umbraco doesn’t ‘crash’ but the UI
still shows the deleted item in the detail panel.
Can
anyone suggest anything or an alternative approach? Is there an API call I could
make to show the root or home node? i.e. move to a different part of the
content tree from where im deleting the document to avoid the UI problem.
Have a look into the ClientTools class, it has some javascript API methods that should help you out, namely ChangeContentFrameUrl and/or SyncTree. See this thread for a simple example.
Deleting current document from content tree via API
I have a situation where I’d like to delete the current document once it meets a certain condition/state. I’ve triggered this check from the before/after publish events but im not having any luck with the UI once I’ve deleted it. It looks like umbraco is trying to update the content tree and/or detail pane after I’ve deleted it, and because it no longer exists it throws a wobbly.
entryDoc.delete(false);
when I don’t delete the doument permanently then umbraco doesn’t ‘crash’ but the UI still shows the deleted item in the detail panel.
Can anyone suggest anything or an alternative approach? Is there an API call I could make to show the root or home node? i.e. move to a different part of the content tree from where im deleting the document to avoid the UI problem.
Thanks
Hi Andrew,
Have a look into the ClientTools class, it has some javascript API methods that should help you out, namely ChangeContentFrameUrl and/or SyncTree. See this thread for a simple example.
-Tom
is working on a reply...