Hi,
I have a need to display multiple ColumnLayouts using LoadOnDemand. Currently everything is working as expecting except the Children ColumnLayouts displayed a empty Grid.
GridModel gridModel = this.GetGridModel(ajaxUpdateTarget, 0); GridUIHelper.ApplyLayout(ref gridModel, vm); gridModel.DataSource = resultSet.Result.AsQueryable(); return gridModel.GetData();Thank you
Hello Vasya,
The example that you provided is working great. However, We don't have to show the Foreign Key (ProductID) to the end user. So I attempted to remove the ProductID from the grid, then it stop working.
Can you please look into it? I am evaluating the Infragistics Product, and it's critical for me to get this working.
Thank you
Hello Phong,
Thank you for providing me your sample.
I spent some time investigating and debugging your project further. What I noticed is that there is no Keys set for the child layout and I set them. This is important because when using GetData method for child layouts path and layout parameters should be defined in order to match the correct layout. If there is no key set for the layout it is being returned as "undefined".
GridColumnLayoutModel layout = new GridColumnLayoutModel(); layout.AutoGenerateColumns = false; layout.Key = "Histories";
GridColumnLayoutModel layout = new GridColumnLayoutModel();
layout.AutoGenerateColumns = false;
layout.Key = "Histories";
Additionally, there is no ForeignKey set for the child layout. Having ForeignKey set is essential for mapping the data for parent and child level. This is necessary in order to set the correct data for corresponding child level. I added a property in your model, in the ProductHistory class, named ProductID. This property is used to make the connection with the parent level. Since I believe this is just a sample data and in your actual data soure you have a field that could act as a foreign this is what I can recommend to ensure that the child levels are correctly loaded. For example:
public class ProductHistory { public int ProductID { get; set; } public string Something { get; set; } } . . . GridColumnLayoutModel layout = new GridColumnLayoutModel(); layout.AutoGenerateColumns = false; layout.Key = "Histories"; layout.ForeignKey = "ProductID"; layout.Columns.Add(new GridColumn() { HeaderText = "Something", Key = "Something", DataType = "string" }); layout.Columns.Add(new GridColumn() { HeaderText = "ProductID", Key = "ProductID", DataType = "number" }); layout.LoadOnDemand = false; layout.DataSourceUrl = string.Format("/Home/GetChildren?ajaxUpdateTarget={0}", "History"); layout.Width = "100%"; gridModel.ColumnLayouts.Add(layout);
public class ProductHistory
{
public int ProductID { get; set; }
public string Something { get; set; }
}
.
layout.ForeignKey = "ProductID";
layout.Columns.Add(new GridColumn() { HeaderText = "Something", Key = "Something", DataType = "string" });
layout.Columns.Add(new GridColumn() { HeaderText = "ProductID", Key = "ProductID", DataType = "number" });
layout.LoadOnDemand = false;
layout.DataSourceUrl = string.Format("/Home/GetChildren?ajaxUpdateTarget={0}", "History");
layout.Width = "100%";
gridModel.ColumnLayouts.Add(layout);
I am attaching my modified sample for your reference.
Please have a look at the provided sample and let me know if you need any further assistance with this matter.
Thank you for getting back to me.
Yes, I did follow the Load On Demand Example.Here is what I am trying to do. Our database has over Million records. We want to take the advantage of SQL Server paging and Load On Demand, so we get the Total Count, then the first 10 records to display. Everything is working so far. However, I have a requirement to display data in Hierarchy, a Parent record would have two or more GridColumnLayoutModels.I attached the code sample. Please help
Thank you for posting in our community.
In order to address the root cause of your issue and provide you with better and more accurate support I will need an isolated working sample where the issue is reproducible. This will help me debug on my side and investigate further and find what is causing this behavior.
Additionally, a sample project illustrating Load on Demand functionality in igHierarchicalGrid could be found at the following link:
http://igniteui.com/hierarchical-grid/load-on-demand
Please have a look at this sample and if you still have any questions or concerns afterwards please fell free to get back to me with your isolated sample.
Looking forward to hearing from you.