Copied to clipboard

Flag this post as spam?

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


  • Thomas Beckert 193 posts 469 karma points
    Apr 11, 2014 @ 12:57
    Thomas Beckert
    0

    Custom Section - Custom dynamic Treenodes - Custom Node Content

    Hi there,

    we want to setup a custom section (did so far), create custom treenodes (did so far for the undeletable, hard coded nodes).

    Now, we want to dynamically add / remove nodes in our custom treenodes, using the database-structure of umbraco. We do not want to create own tables for that.

    Is this possible in umbraco 7 and are there some examples online? Did not found any.

    Our idea:

    We have a hardcoded, undeletable treenode, let's name it myTree1.

    When you click create, you create a new childnode of a Documenttype you declared in your settingsSection, lets call it myTreeChildDocType. This Doctype has a property myContent of type Textstring.

    After creating this childnode, I will load the edit.html of this content, display a textbox to edit / update the property myContent with angular and co.

    So we want to hook this into the umbraco 7 structure. Actually writing our own section that runs identically to the content-section without public Template-representation.

    I hope you got our idea.

    My question: is this possible or is it a complete wrong approach.

    Thank you very much for feedback and code samples.

     

    Best regards - 

     

    Tom

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 11, 2014 @ 16:21
    Jan Skovgaard
    0

    Hi Tom

    Don't know if you perhaps stumpled upon the articles from Markus on creating custom trees etc.? http://www.enkelmedia.se/blogg/2013/11/22/creating-custom-sections-in-umbraco-7-part-1.aspx

    He mentions all the possible actions you could hook into on the context menu of you need it...

    Hope this helps a bit.

    /Jan

  • Thomas Beckert 193 posts 469 karma points
    Apr 12, 2014 @ 10:24
    Thomas Beckert
    0

    Hi Jan,

    thank you for the link. Covers a lot of the things we intend to do. But I still not sure about where to create / save the custom items, based on a DocumentType and get them connected to our custom Treenode...

     

    Best regards -

     

    Tom

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Apr 12, 2014 @ 11:00
    Jan Skovgaard
    0

    Hi Thomas

    Glad the link helped a bit - I'm not certain about the remaining questions though. Hopefully some of the other bright minds in here will pick it up :)

    /Jan

  • Nigel Wilson 944 posts 2076 karma points
    Apr 15, 2014 @ 07:25
    Nigel Wilson
    0

    Hey Thomas

    I created the Tag Manager Package and thought I'd try and upgrade to V7.

    However I cannot get my project build based on the information in the following link:
    http://www.enkelmedia.se/blogg/2013/11/22/creating-custom-sections-in-umbraco-7-part-1.aspx

    So I was wondering if you might be able to share your code, and in return, if I make progress and manage to delete my nodes, etc I would be more than willing to share what I find out ?

    I look forward to hearing from you - my email address is info 'at' yoyocms 'dot' co 'dot' nz

    Cheers, Nigel 

  • Thomas Beckert 193 posts 469 karma points
    Apr 17, 2014 @ 10:01
    Thomas Beckert
    0

    Hi Nigel,

    actually we did it just like in the link you posted above.

    This code should create a section with four Treenodes:

    namespace UmbMyApp
    {
    
        [Application("myAppName", "myAppName", "icon-car", 15)]
        public class myApplication : IApplication { }
    
        [PluginController("myAppName")]
        [Umbraco.Web.Trees.Tree("myAppName", "myAppNameTree", "myAppName Section", iconClosed: "icon-doc")]
        public class myAppTreeController : TreeController
        {
            String[] sectionNodes = { "myAppNameNode1", "myAppNameNode2", "myAppNameNode2", "myAppNameNode4" };
            String[] nlSectionNodes = { "Subnode1" ,"Subnode2", "Subnode3" };
    protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { if (id == global::Umbraco.Core.Constants.System.Root.ToInvariantString()) { var tree = new TreeNodeCollection(); tree.Add(CreateTreeNode(sectionNodes[0], id, queryStrings, sectionNodes[0], "icon-calendar-alt", true)); tree.Add(CreateTreeNode(sectionNodes[1], id, queryStrings, sectionNodes[1], "icon-calendar-alt", true)); tree.Add(CreateTreeNode(sectionNodes[2], id, queryStrings, sectionNodes[2], "icon-calendar-alt", true)); tree.Add(CreateTreeNode(sectionNodes[3], id, queryStrings, sectionNodes[3], "icon-calendar-alt", true)); return tree; } //create Childnodes for Treenode myAppNameNode1 if (id == sectionNodes[0]) { var tree = new TreeNodeCollection(); tree.Add(CreateTreeNode(nlSectionNodes[0], id, queryStrings, nlSectionNodes[0], "icon-globe-alt", false)); tree.Add(CreateTreeNode(nlSectionNodes[1], id, queryStrings, nlSectionNodes[1], "icon-globe-alt", false)); tree.Add(CreateTreeNode(nlSectionNodes[2], id, queryStrings, nlSectionNodes[2], "icon-globe-alt", false)); return tree; } //this tree doesn't suport rendering more than 1 level throw new NotSupportedException(); } } }
  • Nigel Wilson 944 posts 2076 karma points
    Apr 17, 2014 @ 23:08
    Nigel Wilson
    0

    Hi Thomas

    Thanks for posting the code.

    The problem I am experiencing is that my code is in a separate project (C# class library) within my solution.

    The project will not build and outputs errors around missing assemly references. I have added most Umbraco dll's as references to the project but nothing seems to work. 

    So I am wondering: it is possible to create the custom tree code in a C# class library ? If this is possible, then are you able to please confirm all the references at the top of your file ?

    Thanks

    Nigel

  • Nigel Wilson 944 posts 2076 karma points
    Apr 18, 2014 @ 00:40
    Nigel Wilson
    0

    Problem solved - my c# project was set to ASP.NET 4.0 - changed to 4.5 and ... away we gooooooooooo......:-)

  • Thomas Beckert 193 posts 469 karma points
    Apr 18, 2014 @ 07:26
    Thomas Beckert
    0

    As so often in progammers life, the solution can be so easy. :)

  • Nandoh 32 posts 104 karma points
    May 10, 2017 @ 17:38
    Nandoh
    0

    Hi Thomas,

    I know this is an old post, but were you able to achieve what you want?

    I dont want to do the exactly same thing as you but I'm in doubt of what to do. I know that if I create all the views and fields for my custom section in the backoffice I'll successfully save the data in my custom database tables, but I would like to take all the potential that Umbraco gives us (with dynamic datatypes and docTypes) and build the views based on docTypes (and save the data accordingly).

    If you can give me any input about this - even just your experience working with custom sections - I think that will help a lot.

    Thanks. Regards

Please Sign in or register to post replies

Write your reply to:

Draft