So the requirement I have is to build create a tree picker that shows a tree of hierarchical data from a custom API.
So far I have managed to create the tree and also to get it to load the picker using my custom tree using the DialogService and TreePicker dialog.
However i have now hit a wall as when you pick the item it is automatically calling the entityservice to try and get the model object for the picked item. This is an issue because the item is not an Umbraco item but a custom item from our database.
What I want to know is it possible to tell the treepicker NOT to call the entity service and return just the ID or is there a way to tell the treepicker to call my own service to my custom entity model.
My call to the treepicker looks like this:
$scope.openPicker = function () {
var pickerConfig = {
section: "ecom",
treeAlias: "departmenttree",
filter: null,
maxNumber: null,
minNumber: null,
multiPicker: false,
callback: function (data) {
picked = data.id;
if ($scope.control) {
$scope.control.value = data.id;
} else {
$scope.model.value = data.id;
}
$scope.setPreview();
}
};
var d = dialogService.treePicker(pickerConfig);
};
Every time you pick an item in the tree it it fires the the tree event for selection. This fires the nodeSelectHandler.
Which tries to process the selected item to get the actual Umbraco entity by calling the entity service.
I believe I can solve my problem by creating my own custom eventHandler and overriding the one that the tree uses by default allowing me to call my own service to get the info about the object.
Is this even going to be possible? Will update all if I find a way to do it but if anyone has done this successfully I am all ears.
Did you ever manage to get this to work? I am attempting to do something very similar at the moment but am also having issues with the tree picker. If so do you have any example code?
I was a contractor on this project and have since moved on and no longer have the source. We did resolve it but we had to create our own version of the picker by copying the tree picker the umbraco source and modifying its behavior.
Hopefully you get it resolved but if I come across the code again I will post it.
Custom Tree Picker
Hi all.
So the requirement I have is to build create a tree picker that shows a tree of hierarchical data from a custom API.
So far I have managed to create the tree and also to get it to load the picker using my custom tree using the DialogService and TreePicker dialog.
However i have now hit a wall as when you pick the item it is automatically calling the entityservice to try and get the model object for the picked item. This is an issue because the item is not an Umbraco item but a custom item from our database.
What I want to know is it possible to tell the treepicker NOT to call the entity service and return just the ID or is there a way to tell the treepicker to call my own service to my custom entity model.
My call to the treepicker looks like this:
Every time you pick an item in the tree it it fires the the tree event for selection. This fires the nodeSelectHandler.
Which tries to process the selected item to get the actual Umbraco entity by calling the entity service.
I believe I can solve my problem by creating my own custom eventHandler and overriding the one that the tree uses by default allowing me to call my own service to get the info about the object.
Is this even going to be possible? Will update all if I find a way to do it but if anyone has done this successfully I am all ears.
Cheers Peter
Hi,
Did you ever manage to get this to work? I am attempting to do something very similar at the moment but am also having issues with the tree picker. If so do you have any example code?
Regards
Did you find a solution?
Hey Lee
I was a contractor on this project and have since moved on and no longer have the source. We did resolve it but we had to create our own version of the picker by copying the tree picker the umbraco source and modifying its behavior.
Hopefully you get it resolved but if I come across the code again I will post it.
is working on a reply...