Hi Syncfusion,
In a different thread I noted that on versions 18.2.0.47 and 18.2.0.48, the Columns binding on the TreeGrid control broke and we started getting exceptions:
System.InvalidOperationException: The converter specified on 'Syncfusion.Blazor.TreeGrid.TreeGridColumn.EditTemplate' does not derive from JsonConverter or have a public parameterless constructor.
Code would look like below:
<SfTreeGrid @ref="TreeGrid" DataSource="@TreeGridRows"
IdMapping="Id"
ParentIdMapping="ParentId"
TreeColumnIndex="0" AllowSorting="true" AllowPaging="true" Columns="@TreeColumns">
and to overcome this issue we had to remove the columns binding and replace it with a foreach like below:
<SfTreeGrid @ref="TreeGrid" DataSource="@TreeGridRows"
IdMapping="Id"
ParentIdMapping="ParentId"
TreeColumnIndex="0" AllowSorting="true" AllowPaging="true">
<TreeGridColumns>
@foreach (var treeGridColumn in @TreeColumns)
{
<TreeGridColumn Field="@treeGridColumn.Field" HeaderText="@treeGridColumn.HeaderText" Width="@treeGridColumn.Width"></TreeGridColumn>
}
</TreeGridColumns>
the above workaround got the TreeGrid to display the data, and now the columns were showing OK, but we are currently experiencing another issue where we want to change our Columns (replace with new ones alongside a new source).
Since the TreeGrid we are building is of dynamic nature and can have different columns, and can also have an updated data source, we need this to work.
our DataSource is a List of ExpandoObject below:
public List<ExpandoObject> TreeGridRows { get; set; } = new List<ExpandoObject>();
and this is the columns property:
public List<TreeGridColumn> TreeColumns = new List<TreeGridColumn>();
We have tried to use the newly introduced Refresh method:
TreeGrid.Refresh();
StateHasChanged();
but that doesn't seem to work. After we change the columns, we don't see the newly added columns in the TreeGrid.
Can you please let us know if this is a known bug, and if not how to workaround it?
thanks