Hi Jose,
It is possible to dynamically build and customize each of
the TreeGrid column using the type of the model. Please refer to the following
code snippet.
|
<SfTreeGrid>
<TreeGridColumns>
@foreach (var prop in
columnData)
{
<TreeGridColumn Field="@prop.Field"
HeaderText="@prop.HeaderText">
</TreeGridColumn>
}
</TreeGridColumns>
</SfTreeGrid>
@code {
. . . . .
public List<TreeGridColumn> columnData = new
List<TreeGridColumn>()
{
new
TreeGridColumn(){ Field= "id", HeaderText="ID"},
new
TreeGridColumn(){ Field = "name", HeaderText = "Name"},
new
TreeGridColumn(){ Field = "make", HeaderText = "Make"},
};
}
|
Please
refer to the Grid’s documentation for reference : https://blazor.syncfusion.com/documentation/datagrid/columns#dynamic-column-building
If the above solution does not meet your requirement, kindly
share us more details or kindly share us the simple issue replicating sample.
Regards,
Shek Mohammed Asiq