We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Hierarchichal Use

Hi,

I have question regarding TreeGrid for ASP.NET Core.

My aim is to use the TreeGrid for the admin page of my site.

The admin page requires editing of data in 3 tables.
Departments->Categories->Products

When i was looking at the documentation, I could not locate example on how to
add columns for detail tables, the example only shows columns for the main/root table.

Could please provide an example of how to insert, update, list and delete data in suggested hierarchy?

Many Thanks,

Amir



3 Replies

MM Manikandan Manikam Syncfusion Team February 28, 2017 05:42 AM UTC

Hi Amir,  
Currently TreeGrid only supports data collection from same table with parent-child relationship, we can’t create hierarchical structure with multiple table’s data collection. 
Grid control supports relational binding support with multiple tables, please find the demo link below. 
Can you please check this sample and let us know whether this meets your requirement? 
Thanks, 
Manikandan M. 



AR Ardani March 25, 2017 09:15 AM UTC

Hi Manikandan,

Yes, I think your suggestion will cover my requirements. 

Many Thanks,

Ardani


JK Jayaprakash Kamaraj Syncfusion Team March 27, 2017 03:07 PM UTC

Hi Amir, 
  
Based on your request we have created  a Grid sample with Hierarchy in ASP.NET core that can be downloaded from the following link. 
  
  
  
<ej-grid id="Grid" datasource=ViewBag.parent allow-paging="true"  
    child-grid="@(new GridProperties() { 
    QueryString = "EmployeeID", 
    EditSettings = new EditSettings() { 
        AllowEditing =true, AllowAdding=true, AllowDeleting=true 
    }, 
    ToolbarSettings = new ToolbarSettings() { 
        ShowToolbar = true, 
        ToolbarItems = new List<string>() { 
            "add", "edit", "delete", "update", "cancel" 
        } }, 
    DataSource = new DataSource() { 
        Json = ViewBag.child1, 
        InsertURL = "/Home/CellEditInsert", 
        UpdateURL = "/Home/CellEditUpdate", 
        RemoveURL = "/Home/CellEditDelete", 
        Adaptor = "remoteSaveAdaptor" 
    }, 
    Columns = { new Column() { Field = "ID", IsPrimaryKey=true, HeaderText = "OrderID" }, 
                new Column() { Field = "EmployeeID", AllowEditing=false, HeaderText = "OrderID" }, 
                new Column() { Field = "CustomerID", HeaderText = "CustomerID" }, 
                new Column() { Field = "Freight", HeaderText = "Freight" }, 
                new Column() { Field = "ShipCity", HeaderText = "ShipCity" } 
    }, 
    ChildGrid = new GridProperties() 
    { 
        QueryString = "CustomerID", 
        DataSource = new DataSource() { 
            Json = ViewBag.child2, 
            UpdateURL = "/Home/CellEditUpdate1", 
            RemoveURL = "/Home/CellEditDelete1", 
            Adaptor = "remoteSaveAdaptor" 
        }, 
        EditSettings = new EditSettings() { 
            AllowEditing = true, AllowAdding = true, AllowDeleting = true 
        }, 
        ToolbarSettings = new ToolbarSettings() { 
            ShowToolbar = true, 
            ToolbarItems = new List<string>() { "add", "edit", "delete", "update", "cancel" } 
        }, 
        Columns = { 
            new Column() { Field = "CustomerID", IsPrimaryKey=true, AllowEditing=false, HeaderText = "CustomerID" }, 
            new Column() { Field = "CompanyName", HeaderText = "CompanyName" } 
        } 
    } 
  
  
Regards, 
  
Jayaprakash K.  


Loader.
Live Chat Icon For mobile
Up arrow icon