Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am working on a webshop for at customer and I need to make my own tree (done and working) but my problem is when I'm clicking on the node in the tree I cant find out how to call the page. Are there a up-to-date tutorial for the Tree?
Hi Niels,
can you give us some more details ( code or screenshots ) of what you have and want to achieve?
You made your own tree you say, you mean a new section in the backoffice?
Can you show us this how you have set up this section and tree?
Thanks!
/Michaël
Yes... I have made a section with nodes in the Tree. Each node has this code
TreeNode node = CreateTreeNode("shopidee2", "shopid1", queryStrings, "Kategorierxx","icon-umb-content", false, string.Format("Shop/ShopTree/history/{0}", "1")); nodes.Add(node);
The problem for me is to make it call the html (Shop/ShopTree/history/{0})
I have it in:
App_Plugins\Shop\backoffice\shopTree\history.html and history.controller.js
Shop and shopTree is defined in top of ShopTreeController in Controllers
[Tree("shop", "shopTree", "Shop for Umbraco")] [PluginController("Shop")] public class ShopTreeController : TreeController
Do you see the correct url in the bar when clicking on the node?
What does the error console say?
it says it cant find http://domain/umbraco/views/ShopTree/history.html
And I have been looking in the code for https://github.com/ViGiLnT/ApproveIt to see if I could find any thing.... but no luck..
I have added a picture to clarify what I want to do.
Niels,
can you show me the complete code of the GetTreeNodes method?
GetTreeNodes
Thanks
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { //var ctrl = new ShopApiController(); var nodes = new TreeNodeCollection(); //IUser user = UmbracoContext.Security.CurrentUser; //check if we're rendering the root node's children if (id == Constants.System.Root.ToInvariantString()) { TreeNode node = CreateTreeNode("shopid1", "-1", queryStrings, "Kategorier", "icon-umb-content", true); nodes.Add(node); node = CreateTreeNode("shopid2", "-1", queryStrings, "Produkter", "icon-umb-content", true); nodes.Add(node); node = CreateTreeNode("shopid3", "-1", queryStrings, "Kunder", "icon-umb-content", true); nodes.Add(node); } else { // We're rendering the node properties int level = id.Count(c => c == '-'); //if (level == 0) //{ if (id == "shopid1") { TreeNode node = CreateTreeNode("shopidee2", "shopid1", queryStrings, "Kategorierxx", "icon-umb-content", false, string.Format("Shop/ShopTree/history/{0}", "1")); nodes.Add(node); } if (id == "shopid2") { TreeNode node = CreateTreeNode("shopidee2", "shopid2", queryStrings, "Produkterxx", "icon-umb-content", false, string.Format("Shop/ShopTree/history/{0}", "1")); nodes.Add(node); } } return nodes; }
Ok and now your plugin folder inside the App_Plugins folder, can you show me the content of it with all folders and files ( screenshot )
In the Tree folder the filename is ShopTreeController.cs
looks all good to me.
The url when clicking on the node, is it like:
umbraco/#/shop/shoptree/history/1
umbraco/#/Shop/ShopTree/history/1
The only difference I can see with my code for custom sections is that I have a dash in front of my node tree urls:
nodes.Add(this.CreateTreeNode("notes", id, queryStrings, "All notes", "icon-notepad", false, "/notely/notely/notes/0"));
ok :( then it shows //Shop/ShopTree....
I will try to go through the code again :)
Thank you for your time
I always build my routes for tree nodes like this:
queryStrings.GetValue<string>("application") + _treeAlias.EnsureStartsWith('/') + "/overviewCalendar/all"
And then make sure that your folder structure uses the tree alias as folder name in this example.
So in your example I would try to change ShopTree with shopTree as your folder is named shopTree.
Regards David
where do you define _treeAlias?
the TreeController has a property for TreeAlias which you can use directly. In my example I wrapped the creation and therefore used a custom property.
But normally you can just use this.TreeAlias in your custom tree.
whoooo.......
the code
TreeNode node = CreateTreeNode("shopidee2", "shopid1", queryStrings, "Kategorierxx", "icon-umb-content", false, queryStrings.GetValue<string>("application") + TreeAlias.EnsureStartsWith('/') + string.Format("/history/{0}", "1")); nodes.Add(node);
thats work :) Now I get anohter error but that was an expected error
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Tutorial for adding content to tree?
I am working on a webshop for at customer and I need to make my own tree (done and working) but my problem is when I'm clicking on the node in the tree I cant find out how to call the page. Are there a up-to-date tutorial for the Tree?
Hi Niels,
can you give us some more details ( code or screenshots ) of what you have and want to achieve?
You made your own tree you say, you mean a new section in the backoffice?
Can you show us this how you have set up this section and tree?
Thanks!
/Michaël
Yes... I have made a section with nodes in the Tree. Each node has this code
The problem for me is to make it call the html (Shop/ShopTree/history/{0})
I have it in:
App_Plugins\Shop\backoffice\shopTree\history.html and history.controller.js
Shop and shopTree is defined in top of ShopTreeController in Controllers
Do you see the correct url in the bar when clicking on the node?
What does the error console say?
/Michaël
it says it cant find http://domain/umbraco/views/ShopTree/history.html
And I have been looking in the code for https://github.com/ViGiLnT/ApproveIt to see if I could find any thing.... but no luck..
I have added a picture to clarify what I want to do.
Niels,
can you show me the complete code of the
GetTreeNodes
method?Thanks
/Michaël
Ok and now your plugin folder inside the App_Plugins folder, can you show me the content of it with all folders and files ( screenshot )
/Michaël
In the Tree folder the filename is ShopTreeController.cs
Niels,
looks all good to me.
The url when clicking on the node, is it like:
/Michaël
The only difference I can see with my code for custom sections is that I have a dash in front of my node tree urls:
/Michaël
ok :( then it shows //Shop/ShopTree....
I will try to go through the code again :)
Thank you for your time
Hi Niels,
I always build my routes for tree nodes like this:
And then make sure that your folder structure uses the tree alias as folder name in this example.
So in your example I would try to change ShopTree with shopTree as your folder is named shopTree.
Regards David
where do you define _treeAlias?
Hi Niels,
the TreeController has a property for TreeAlias which you can use directly. In my example I wrapped the creation and therefore used a custom property.
But normally you can just use this.TreeAlias in your custom tree.
Regards David
whoooo.......
the code
thats work :) Now I get anohter error but that was an expected error
is working on a reply...