Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
715
Displaying complex model in hierarchical grid.
posted

I'm trying to make a Hierarchical Grid using my iggrid. My Model is a bit complex, how can I configure my grid to display this model in an hierarchical fashion? Here is my model;

public class RoleRightsModel
{
public string Module { get; set; }
public List<ScreenType> ScreenType { get; set; }
}

public class ScreenType
{
public string ScreenTypeName { get; set; }
public List<Screen> Screen{ get; set; }
}

public class Screen
{
public string ScreenName { get; set; }
public List<Permission> Permission { get; set; }
}

public class Permission
{
public bool CanAdd { get; set; }
public bool CanEdit { get; set; }
public bool CanDelete { get; set; }
public bool CanPrint { get; set; }
}

Basically I want the name of the nodes to be listed once(distinct) in a tree view like structure 

For example:

[Module Grid]

   (1)  -Security Manger [ScreenType Grid] 

                      (1a)-Report [Screen Grid]

                                    (1aa)-Dashboard [Permission Grid]

                                                      -CanAdd  -  CanEdit   -CanDelete  -CanPrint   (checkbox columns)

                                    (1ab)-Screen2 [Permission Grid]

                                                      -CanAdd  -  CanEdit   -CanDelete  -CanPrint   (checkbox columns)

                      (1b)-Data entry [Screen Grid]                

                                   (1ba)-Screen3 [Permission Grid]

                                                      -CanAdd  -  CanEdit   -CanDelete  -CanPrint   (checkbox columns)

                                    (1bb)-Screen4 [Permission Grid]

                                                      -CanAdd  -  CanEdit   -CanDelete  -CanPrint   (checkbox columns)

   2  -System Admin [ScreenType Grid] 

                         ...

                                  ....

                                               ....

  • 25665
    Offline posted

    Hello,

    Thank you for contacting Infragistics!

    I have done some looking into this matter and have the following information. This behavior can be achieved by using the igHierarchicalGrid. You will have an igHierarchicalGrid for each main grid you want. Then on the child level you will create a columnLayout for each child grid you want to display. For example the following code would create to child grids. One for each column layout:

    .ColumnLayouts(layout =>

                 {                 layout.For(x => x.Products)

                         .ForeignKey("CategoryID")

                         .PrimaryKey("ProductID")

                         .AutoGenerateColumns(false)

                         .DataSourceUrl(Url.Action("BindProduct")

                         .Columns(column =>

                         {

                             column.For(x => x.ProductID).HeaderText("ID");

                             column.For(x => x.ProductName).HeaderText("Name");

                             column.For(x => x.CategoryID).HeaderText("Category")

    ;                         column.For(x => x.UnitPrice).HeaderText("Unit Price");

                         });

                     layout.For(x => x.Products2)

                         .ForeignKey("CategoryID")

                         .PrimaryKey("ProductID")

                         .AutoGenerateColumns(false)

                         .DataSourceUrl(Url.Action("BindProduct"))

                         .Columns(column =>

                         {

                             column.For(x => x.ProductID).HeaderText("ID");

                             column.For(x => x.ProductName).HeaderText("Name");

                             column.For(x => x.CategoryID).HeaderText("Category");

                             column.For(x => x.UnitPrice).HeaderText("Unit Price");

                         });

                 })

    Please let me know if you have any further questions concerning this matter.