I'm trying to register some javascript code in the ContentService.Trashing event, but since it's a plain AJAX call, I don't have a Page reference to pass to the ScriptManager.RegisterStartupScript method.
Is it possible to register some javascript code somehow when a Node is being deleted (/moved to trash)?
I'm 99.99% sure it's not currently possible.
As you said yourself, it's done through an AJAX call and thus, there is no page to hook into.
The only solution would have been to register some javascript when the content tree loads, and then rely on a pub/sub system to be able to hook into a Trashing event in the responsible javascript.
However, unfortunately, that won't happen before Belle, so your options are pretty slim.
I'm guessing someone could implement this through a PR, though I'm not entirely sure how it should be done or if it would be considered at the moment.
I had a quick look at the actionDelete function in UmbracoApplicationActions.js ... there's a jQuery trigger in there called 'nodeDeleting' (line:365) - so you could hook into that? (given that you can register your JavaScript before that call)
For an example how to hook into the trigger, see UmbracoTree.js line:103-106
ContentService.Trashing event - register javascript code
Hi all,
I'm trying to register some javascript code in the ContentService.Trashing event, but since it's a plain AJAX call, I don't have a Page reference to pass to the ScriptManager.RegisterStartupScript method.
Is it possible to register some javascript code somehow when a Node is being deleted (/moved to trash)?
Ty!
Hi Stefan
I'm 99.99% sure it's not currently possible.
As you said yourself, it's done through an AJAX call and thus, there is no page to hook into.
The only solution would have been to register some javascript when the content tree loads, and then rely on a pub/sub system to be able to hook into a Trashing event in the responsible javascript.
However, unfortunately, that won't happen before Belle, so your options are pretty slim.
I'm guessing someone could implement this through a PR, though I'm not entirely sure how it should be done or if it would be considered at the moment.
Cheers
- Mads
I had a quick look at the
actionDeletefunction inUmbracoApplicationActions.js... there's a jQuery trigger in there called 'nodeDeleting' (line:365) - so you could hook into that? (given that you can register your JavaScript before that call)For an example how to hook into the trigger, see
UmbracoTree.jsline:103-106Cheers
- Lee
Wow, nice find Lee, thanks for making my post completely irrelevant :D
Gonna play around with that myself, #h5yr !
Stefan, if you need guidance in how to inject javascript into the back office you can reference my answers in this post -> http://our.umbraco.org/forum/developers/extending-umbraco/44019-Possible-to-deeplink-from-dashboard-to-specific-tab-on-a-content-node
Thanks Lee, that worked fine for me! :-)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.