[CLOSED] [Razor] TreeGrid in Razor

  1. #1

    [CLOSED] [Razor] TreeGrid in Razor

    Hi,

    I try to build a simple TreeGrid with Razor but it doesn't show the contents like the grid.
    Here is my code:

    @model dynamic
    
    @{
        Layout = null;
    }
    @Html.X().ResourceManager()
    @(Html.X().TreePanel()
    .Width(500)
    .Height(800)
    .UseArrows(true).Collapsible(true).Title("Title")
    .RootVisible(false)
    .MultiSelect(true)
    .SingleExpand(true)
    .FolderSort(true)
    .Fields(f =>
                {
                    f.Add(Html.X().ModelField().Name("name"));
                    f.Add(Html.X().ModelField().Name("description"));
                })
    .ColumnModel(c =>
                     {
                         c.Add(Html.X().TreeColumn().DataIndex("name").Text("Name").Sortable(true).Flex(2));
                         c.Add(Html.X().Column().DataIndex("description").Text("Description").Sortable(true).Flex(3));
                     })
    .Root(r => r.Add(Html.X().Node().Text("Root")
        .Children(c=>
                      {
                          c.Add(Html.X().Node()
                                    .CustomAttributes(a =>
                                                          {
                                                              a.Add(new ConfigItem("name", "name1", ParameterMode.Value));
                                                              a.Add(new ConfigItem("description", "description1", ParameterMode.Value));
                                                          })
                                    .Children(cl =>
                                                  {
                                                      cl.Add(Html.X().Node().Leaf(true)
                                                                 .CustomAttributes(a =>
                                                                                       {
                                                                                           a.Add(new ConfigItem("name", "name11", ParameterMode.Value));
                                                                                           a.Add(new ConfigItem("description", "description11", ParameterMode.Value));
                                                                                       }));
                                                      cl.Add(Html.X().Node().Leaf(true)
                                                                 .CustomAttributes(a =>
                                                                                       {
                                                                                           a.Add(new ConfigItem("name", "name12", ParameterMode.Value));
                                                                                           a.Add(new ConfigItem("description", "description12", ParameterMode.Value));
                                                                                       }));
                                                  })
                              );
                          c.Add(Html.X().Node()
                                    .CustomAttributes(a =>
                                                          {
                                                              a.Add(new ConfigItem("name", "name2", ParameterMode.Value));
                                                              a.Add(new ConfigItem("description", "description2", ParameterMode.Value));
                                                          })
                                    .Children(cl =>
                                                  {
                                                      cl.Add(Html.X().Node().Leaf(true)
                                                                 .CustomAttributes(a =>
                                                                                       {
                                                                                           a.Add(new ConfigItem("name", "name21", ParameterMode.Value));
                                                                                           a.Add(new ConfigItem("description", "description21", ParameterMode.Value));
                                                                                       }));
                                                      cl.Add(Html.X().Node().Leaf(true)
                                                                 .CustomAttributes(a =>
                                                                                       {
                                                                                           a.Add(new ConfigItem("name", "name22", ParameterMode.Value));
                                                                                           a.Add(new ConfigItem("description", "description22", ParameterMode.Value));
                                                                                       }));
                                                  })
                              );
                      })
        ))
    )
    Could you tell me what is the missing things I need to add to this code?
    Thanks in advance,
    Last edited by Daniil; Oct 01, 2012 at 11:36 AM. Reason: [CLOSED]
  2. #2
    Instead 'c.Add' in '.ColumnModel(c =>'
    you have to use 'c.Columns.Add'
  3. #3
    Quote Originally Posted by Vladimir View Post
    Instead 'c.Add' in '.ColumnModel(c =>'
    you have to use 'c.Columns.Add'
    Thanks for your help. You can mark this as CLOSED

Similar Threads

  1. [CLOSED] [RAZOR] DraggablePanelConfig doesn't have StartDrag in Razor
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 28, 2012, 2:37 PM
  2. Please help MVC 3 Razor
    By fosteliss in forum 2.x Help
    Replies: 7
    Last Post: Jul 26, 2012, 4:59 PM
  3. [CLOSED] [Razor] HyperLink Text in Razor
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 20, 2012, 12:16 PM
  4. [CLOSED] [Razor] Add GridView to GridPanel in razor
    By boris in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: May 09, 2012, 4:23 PM
  5. [CLOSED] [Razor] Setup Auto load panel in razor
    By UnifyEducation in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Apr 27, 2012, 10:54 AM

Posting Permissions