BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Is there an easy way to load a list, with a nested list into a DataGrid?
Something like:
<GridColumn Field=@nameof(OverviewData.Mail) Width="230"></GridColumn>
<GridColumnField=@nameof(OverviewData.Designation) Width="170"></GridColumn>
Foreach(var item in nestedElement)
{
<GridColumnField=@nameof(NestedData.X) Width="170"></GridColumn>
<GridColumnField=@nameof(NestedData.Y) Width="170"></GridColumn>
}
public class OverviewData
{
public string Mail { get; set; }
public string Designation { get; set; }
public List<NestedData> Nested { get; set; }
}
public class NestedData
{
public string x { get; set; }
public string y { get; set; }
}
Hi Soren,
Greetings from Syncfusion support.
We analyzed your
query, and we suggest using Complex data binding to achieve your requirement.
We have discussed this topic in our UG documentation. Kindly refer to the
attached documentation for your reference.
Reference
link: https://blazor.syncfusion.com/documentation/datagrid/columns#expandoobject-complex-data-binding
Kindly get back to us if you have further queries.
Regards,
Keerthana.
Hi Keerthana, thanks for the reply. What if I have a list of EmployeeNames in the EmployeeData list?
How would I bind one or more to the grid? Dynamic columns muse be made
@code{
public List<EmployeeData> Employees { get; set; }
protected override void OnInitialized()
{
Employees = Enumerable.Range(1, 9).Select(x => new EmployeeData()
{
EmployeeID = x,
Name = new EmployeeName() {
FirstName = (new string[] { "Nancy", "Andrew", "Janet", "Margaret", "Steven" })[new Random().Next(5)],
LastName =(new string[] { "Davolio", "Fuller", "Leverling", "Peacock", "Buchanan" })[new Random().Next(5)]
},
Title = (new string[] { "Sales Representative", "Vice President, Sales", "Sales Manager",
"Inside Sales Coordinator" })[new Random().Next(4)],
}).ToList();
}
public class EmployeeData
{
public int? EmployeeID { get; set; }
public List<EmployeeName> Name { get; set; }
public string Title { get; set; }
}
public class EmployeeName
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
}
Hi Soren,
Welcome from Syncfusion support.
Currently, we don’t have support for this
feature. Already, we have considered a feature task to implement this feature “Provide
data operation for one-to-many relationship columns” request and added this
to our feature request list. Based on specific parameters including product
vision and technological feasibility we will implement this feature in any of
our upcoming releases.
Please follow up on the below feedback report page link for future updates regarding the release timeline of this feature.
https://www.syncfusion.com/feedback/12731/provide-data-operation-for-one-to-many-relationship-columns
Regards,
Keerthana.