Copied to clipboard

Flag this post as spam?

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


  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Aug 04, 2014 @ 12:10
    Tim
    0

    Custom Tree Events

    Using v7, I'd like to hook into the "selected" event client side in angular, for a custom tree.

    I have a custom tree working just fine, I just can't seem to get the event hooked in. I can theoretically use something like this:

    $scope.dialogTreeEventHandler.bind("treeNodeSelect", function(ev, args){
    

    However, if I just include the code as is, it fails, because the tree isn't loaded yet. So how would I include this in such a way that it would actually hook into the event and fire?

    Any help would be greatly appreciated!

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Aug 04, 2014 @ 12:29
    Warren Buckley
    0

    Hi Tim,
    I haven't done this myself yet, but I would say the source code of Umbraco is a good place to look.

    https://github.com/umbraco/Umbraco-CMS/blob/7.1.5/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js
    https://github.com/umbraco/Umbraco-CMS/blob/7.1.5/src/Umbraco.Web.UI.Client/src/common/directives/umbtreeitem.directive.js

    Also I am not entirely clear what you are trying to do but I would use the $on("treeNodeSelect") method perhaps at a guess.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Aug 04, 2014 @ 12:30
    Jeroen Breuer
    0

    Here are some examples on how to change values that are returend from the web api: http://issues.umbraco.org/issue/U4-2670#comment=67-15418

    It might help :).

    Jeroen

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Aug 04, 2014 @ 12:54
    Tim
    0

    Hi Warren!

    Thanks for the quick reply, much appreciated :)

    Basically, the custom tree loads in some (non-umbraco) MVC code from an app I'm integrating into the back office. When someone selects an item from the tree, I want to call some client side stuff in Umbraco before it loads in the MVC into the legacy iFrame viewer (basically, I'm logging some stuff with a custom logger, which I also have working, but just need to get everything wired together).

    My problem is where to actually bind the event, as if I just inject the code directly into the page, $scope.on(), or the tree service isn't defined. Basically, I can't seem to find the right point to wire in the event at so that it will actually work....... any ideas? The tree itself doesn't have it's own controller, as it's just using the standard tree views, so I'm a bit stumped as to how to wire in the even to my specific tree.

Please Sign in or register to post replies

Write your reply to:

Draft