Copied to clipboard

Flag this post as spam?

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


  • Taylor Mitchell 19 posts 43 karma points
    Sep 28, 2015 @ 13:35
    Taylor Mitchell
    0

    Anyone know of a way to use the TreeController with MVC?

    I am building a custom section.

    I am having trouble with the BaseTree and would rather be using the TreeController, because it's just easier to use. Is there a way to be able to still use MVC instead of Angular and use TreeController? Thanks for any help.

  • Robert Foster 459 posts 1820 karma points MVP 3x admin c-trib
    Sep 28, 2015 @ 14:25
    Robert Foster
    0

    Edit: Sorry, bit vague on the actual answer to your question - in short, you can't use MVC with the TreeController.

    I would recommend checking out the AngularJs Workbook found here:

    https://github.com/umbraco/AngularWorkbook

    In relation to trees and editing nodes, there is a convention around where the angular views are located for editing but I'm having a little trouble finding the documentation on it right now. Best thing to do maybe is to read the Umbraco source code for some of the trees.

    Documentation for the TreeController is here:

    https://our.umbraco.org/documentation/Extending/Section-Trees/trees-v7

    It's currently lacking in the Tree Creation area, but contains a lot of useful information anyway.

    To create your own tree, you can either inherit directly from TreeControllerBase or TreeController - the latter encapsulates a few things based on the TreeAttribute so you don't have to define everything - e.g. (a skeleton class for you):

        [Tree("myApp", "myTree", "My Tree")]
    [PluginController("MyApp")]
    public class MyTreeController : TreeController
    {
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
    
        }
    
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
        }
    }
    
  • Taylor Mitchell 19 posts 43 karma points
    Sep 28, 2015 @ 15:30
    Taylor Mitchell
    0

    I did find I could edit the route using

    node.RoutePath = "/myroute/"
    

    but I'm having the same issues as this ticket

    http://issues.umbraco.org/issue/U4-6617

  • Dave Woestenborghs 3504 posts 12134 karma points MVP 9x admin c-trib
    Oct 02, 2015 @ 06:49
    Dave Woestenborghs
    0

    Hi Taylor,

    I did a session on creating custom sections using Angular at last years Umbraco UK Festival.

    The source code of that talk can be found here : https://bitbucket.org/dawoe/umbukfestival2014/

    The video of the talk is also up on youtube : https://www.youtube.com/watch?v=_sX9eZSn9HI

    I explain how to set up the tree controller and how the routing works.

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft