I'm pretty new to the Umbraco development and try to create a custom section.
Creating the tree, controllers and views so far.
Now i've got a structure like this:
-Rootelement
--List
---Listitem 1...
---Listitem n
My Listitem got a rightclick optionitem "delete" and if i click this one it should be deleted.
When I press the item umbraco looking for the delete view that already exists but i cant get any information about the Listitem, that should be deleted, in the deletecontroller.
I look at the html code and see that Umbraco use the "performaction" method. In the umbraco.Controller.js i found the method. it looks like:
/**
* @ngdoc controller
* @name Umbraco.Dialogs.LegacyDeleteController
* @function
* @description
* The controller for deleting content
*/
function LegacyDeleteController($scope, legacyResource, treeService, navigationService) {
How to delete a node from a custom Tree
Hi guys!
I'm pretty new to the Umbraco development and try to create a custom section.
Creating the tree, controllers and views so far.
Now i've got a structure like this:
-Rootelement
--List
---Listitem 1...
---Listitem n
My Listitem got a rightclick optionitem "delete" and if i click this one it should be deleted.
When I press the item umbraco looking for the delete view that already exists but i cant get any information about the Listitem, that should be deleted, in the deletecontroller.
I look at the html code and see that Umbraco use the "performaction" method. In the umbraco.Controller.js i found the method. it looks like:
/**
* @ngdoc controller
* @name Umbraco.Dialogs.LegacyDeleteController
* @function
* @description
* The controller for deleting content
*/
function LegacyDeleteController($scope, legacyResource, treeService, navigationService) {
$scope.performDelete = function() {
//mark it for deletion (used in the UI)
$scope.currentNode.loading = true;
legacyResource.deleteItem({
nodeId: $scope.currentNode.id,
nodeType: $scope.currentNode.nodeType,
alias: $scope.currentNode.name,
}).then(function () {
$scope.currentNode.loading = false;
//TODO: Need to sync tree, etc...
treeService.removeNode($scope.currentNode);
navigationService.hideMenu();
});
};
$scope.cancel = function() {
navigationService.hideDialog();
};
}
angular.module("umbraco").controller("Umbraco.Dialogs.LegacyDeleteController", LegacyDeleteController);
But if i try to get the currenNode of $scope in my Controller the answer of the console ist just:
TypeError: Cannot set property 'loading' of undefined
is working on a reply...