javascript - Get parent node in custom section tree -
i have multi level tree in custom-section of umbraco 7, root node country.
- denmark
- item 1
- item 2
- sweeden
- item 1
- item 2
- norway
- item 1
- item 2
now, when working item 2 of denmark, node-id of root-node (denmark) know country id i'm working under.
is there javascript api recurse on node levels, , top-most expanded?
thanks in advance. jonas
what did use editorstate
(i'm running umbraco 7.5.7)
angular.module("umbraco").controller("client.controller", function ($scope, editorstate) { // rootnode out of path. var rootnode = editorstate.current.path.split(",")[1]; });
since path contains entire structure current node located, second first node root node.
another solution might this:
(haven't tested myself)
https://our.umbraco.org/forum/developers/extending-umbraco/73796-how-to-get-the-parentid-of-the-current-node-in-custom-tree-using-angularjs
which in simple way states:
inject appstate , treeservice angular controller
this top node of current tree:
var rootnode = appstate.gettreestate("currentrootnode");this current selected node in custom tree
var selectednode = appstate.gettreestate("selectednode");
Comments
Post a Comment