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
200
How to bind object graph to hierarchical grid
posted

Hi,

This is the firs time, I would work on Infragistics grid. I am aware that my question is very basic ad I am sorry for that. Based upon the answers I will get on to my actual questions.

I am trying to create a hierarchical grid, using MVC helpers and following this example (http://www.igniteui.com/hierarchical-grid/aspnet-mvc-helper).

In this example I noticed that data is kept in DataSet and DataTables, thus my first question is: Is it really necessary to work off of a data set to setup a hierarchical grid? In my application I will get an object graph lets say a list of customers with multiple orders. I want to bind this object graph to a Grid to show data is some sort of hierarchy. And I will get data for a page in one shot let's 10 record from the list of many records.

Then could someone please explain, how the children data is binded on the grid? Will the Infragistics grid automatically get the Children's data based on its parent, or do I need to configure that by some kind of method which takes an ID of the customer and return its order?

Any thoughts around it would be helpful or if you could refer me to an more real-life example on grid binding. Thanks in advance.

-KP

Parents
  • 8421
    posted

    Hello KP,

    You can definitely bind to a collection of data and not use a DataSet or DataTable. For example, you could use a WebAPI service and pass over IQueryable collections of your data objects:

    http://www.igniteui.com/help/ighierarchicalgrid-binding-to-webapi

    If you wanted you could instead pass your model through you controller to the view as your page's model. As long as there is a collection of type IQueryable that is passed over your application will serialize the data to a JSON array which the igHierarchicalGrid will be able to work with. Then, as long as your ColumnLayouts are specificied correctly, or if you set AutoGenerateLayouts to true, then the grid will be able to properly understand and work with your hierarchical data.

    For more information about the binding requirements, please see the following section of the igHierarchicalGrid Overview:

    http://www.igniteui.com/help/ighierarchicalgrid-binding-to-webapi

Reply Children