Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Stefan Kip 1614 posts 4131 karma points c-trib
    Aug 29, 2013 @ 15:29
    Stefan Kip
    0

    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!

  • Mads Krohn 211 posts 504 karma points c-trib
    Aug 29, 2013 @ 15:39
    Mads Krohn
    0

    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

  • Lee Kelleher 4026 posts 15837 karma points MVP 13x admin c-trib
    Aug 29, 2013 @ 16:03
    Lee Kelleher
    100

    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

    Cheers
    - Lee

  • Mads Krohn 211 posts 504 karma points c-trib
    Aug 29, 2013 @ 16:08
    Mads Krohn
    2

    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

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Sep 04, 2013 @ 10:02
    Stefan Kip
    0

    Thanks Lee, that worked fine for me! :-)

  • 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.

Please Sign in or register to post replies