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?
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;
});
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
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:
Thanks, Dan.
Great stuff thanks. Despite some fun with browser caching that got me on the right track to getting everything working :)
is working on a reply...