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?
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.
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:
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!
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.
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
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.
is working on a reply...