How do I create new tree definiton?

Topics: Community, General
Nov 7, 2013 at 3:07 PM
I tried to create Tree definition. I've created new xml file in COmposite\TreeDefinitions as documentation said and put this xml in it: ``` ``` <?xml version="1.0" encoding="utf-8"?> <ElementStructure xmlns="http://www.composite.net/ns/management/trees/treemarkup/1.0" xmlns:f="http://www.composite.net/ns/function/1.0"> <ElementStructure.AutoAttachments> <NamedParent Name="Data" Position="Top" /> </ElementStructure.AutoAttachments> <ElementRoot> <Children> <Element Label="Members" Id="MembersPerspective" OpenedIcon="pagetype-pagetype-rootfolder-open" Icon="pagetype-pagetype-rootfolder"> <Children> <DataElements> <!-- other nested elements if needed --> </DataElements> </Children> </Element> </Children> </ElementRoot> </ElementStructure> ``` ``` I expected at least to see new button under Data but nothing happened. Any help or tip would be great?
Nov 7, 2013 at 5:08 PM
Hello

I did this last evening writing a blog post about a feature in 4.1 : http://www.s-innovations.net/Blog/2013/11/06/Using-Razor-files-inside-the-console-with-Composite-C1-41

Try look in your log (see in the blog post how the errors get output there). Do you get any errors when you edit the file?
Marked as answer by draxtor on 11/8/2013 at 9:12 AM
Developer
Nov 7, 2013 at 7:58 PM
Edited Nov 7, 2013 at 7:59 PM
Your <DataElements> is missing a required attribute "Type". This causes an error and as a result, you have no new element in the Data perspective.

Please see http://docs.composite.net/Console/Tree-Schema-Definition-Reference/DataElements

and http://docs.composite.net/Console/Guide-to-Applications/How-to-Attach-Elements-to-Tree-Structures#_Data_Elements

For an experiment, you can specify a built-in type (say, "Composite.Data.Types.IPage") to make sure your tree definition is working, after all. Something like this:
<?xml version="1.0" encoding="utf-8"?>
<ElementStructure xmlns="http://www.composite.net/ns/management/trees/treemarkup/1.0" xmlns:f="http://www.composite.net/ns/function/1.0">
  <ElementStructure.AutoAttachments>
    <NamedParent Name="Data" Position="Top" />
  </ElementStructure.AutoAttachments>
  <ElementRoot>
    <Children>
      <Element Label="Members" Id="MembersPerspective" OpenedIcon="pagetype-pagetype-rootfolder-open" Icon="pagetype-pagetype-rootfolder">
        <Children>
          <DataElements Type="Composite.Data.Types.IPage">
            <!-- other nested elements if needed -->
          </DataElements>
        </Children>
      </Element>
    </Children>
  </ElementRoot>
</ElementStructure>
Of course, instead of the built-in type "Composite.Data.Types.IPage", you will use your own type you need in your tree definition.

And as @pksorensen suggest, you can always look up the logs for any errors in Tree Defs. If there are errors, elements will not appear in the C1 Console.
Marked as answer by draxtor on 11/8/2013 at 9:12 AM
Nov 8, 2013 at 4:14 PM
thanks guys this solved my problem. Currently I have version 4.0 so I've used aspx page but I'll try 4.1 in following days