Copied to clipboard

Flag this post as spam?

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


  • Tom Harrington 10 posts 30 karma points
    Sep 18, 2014 @ 14:26
    Tom Harrington
    0

    Property Editor : Getting root of node currently being edited

    Hi there,

    Using U7, I'm implementing a custom property editor which shows a dropdown list of all nodes of a particular document type. I currently have this working, where the property editor goes back to the server to retrieve a list of all the nodes from a UmbracoAuthorizedJsonController. The key part is the line Services.ContentService.GetContentOfContentType(MYDOCTYPEID)

    However I now need to trim this list so that it only returns the nodes underneath the root of the page where the property editor is being used. I.e I don't want it to show nodes which belong to the other sites installed in the same umbraco installation, just the current one.

    I can't seem to work out how to find the details of the page being currently edited, or created. But either way I need to find the root under which we are currently working, from within this UmbracoAuthorizedJsonController. Can anyone please help?

    Thanks, Tom

  • Dan Lister 416 posts 1974 karma points c-trib
    Sep 18, 2014 @ 14:38
    Dan Lister
    0

    Hi Tom,

    You will have to pass the current page ID as part of your UmbracoAuthorizedJsonController request. From there, you will be able to retrieve all descendants from the current page of the type you wish. You can grab the current page ID in Angular using the following:

    angular.module("umbraco").controller("", function ($scope, $routeParams) {
        var nodeId = $routeParams.id;
    });
    

    Thanks, Dan.

  • Tom Harrington 10 posts 30 karma points
    Sep 19, 2014 @ 14:06
    Tom Harrington
    0

    Great stuff thanks. Despite some fun with browser caching that got me on the right track to getting everything working :)

Please Sign in or register to post replies

Write your reply to:

Draft