I have the next grid. When the data is static, the grid works fine, no issues. But when the datasource is being refresh based on a external filter, it throws the error bellow. I already tried with Observable and just plain list and i get the same error. It is very frustrating :(
<SfGrid @ref="@grid"
DataSource="ObservableData"
TValue="Model"
AllowExcelExport="true"
AllowFiltering="false"
AllowPaging="true"
AllowResizing="true"
AllowSorting="true"
Height="100%"
Width="100%">
<GridPageSettings PageSize="20" PageSizes="new[] {20, 50, 100}"/>
<GridEvents OnLoad="@((x) => OnLoadGridHandler())" TValue="Model"></GridEvents>
<GridColumns>
<GridColumn
AllowResizing="false"
AllowEditing="false"
AllowFiltering="false"
AllowReordering="false"
AllowSorting="false"
AllowGrouping="false"
ShowInColumnChooser="false"
ShowColumnMenu="false"
Width="100px"
AllowSearching="false">
<Template>
@{
var chamber = (Model) context;
<div class="btn-group">
<a rel='nofollow' href="#" class="btn btn-sm warning orange" @onclick="@(() => { isLoading = true; NavigateToPage($"/chamber/{chamber.Id}/details");})">
<i class="fa fa-edit"></i>
</a>
</div>
}
</Template>
</GridColumn>
<GridColumn Field="ModelName" HeaderText="Model Name"/>
<GridColumn Field="@nameof(Model.ActiveStatus)" HeaderText="Status" Width="100px">
<Template>
@{
@if(context is Model chamber)
{
@if (chamber.IsEnabled)
{
<button class="btn btn-sm btn-success" @onclick="@(e => ToggleChamber(chamber.Id, chamber.IsEnabled))" style="cursor: pointer">
Disable
</button>
}
else
{
<button class="btn btn-sm btn-danger" @onclick="@(e => ToggleChamber(chamber.Id, chamber.IsEnabled))" style="cursor: pointer">
Enable
</button>
}
}
}
</Template>
</GridColumn>
<GridColumn Field="@nameof(Model.ActiveCampaignSubDomain)" HeaderText="Campaign Site" >
<Template>
@{
if (context is Model chamber)
{
if (!string.IsNullOrWhiteSpace(chamber.ActiveCampaignSubDomain))
{
<a rel='nofollow' href="@($"{chamber.ActiveCampaignSubDomain}.{AdminConfiguration.PrimaryDomainName}")" class="" target="_blank">
@chamber.ActiveCampaignName
</a>
}
}
}
</Template>
</GridColumn>
</GridColumns>
</SfGrid>
Error:
[2020-11-12T01:27:35.934Z] Error: System.Text.Json.JsonException: A possible object cycle was detected which is not supported. This can either be due to a cycle or if the object depth is larger than the maximum allowed depth of 0.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_SerializerCycleDetected(Int32 maxDepth)
at System.Text.Json.JsonSerializer.Write(Utf8JsonWriter writer, Int32 originalWriterDepth, Int32 flushThreshold, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.JsonSerializer.WriteCore(Utf8JsonWriter writer, Object value, Type type, JsonSerializerOptions options)
at System.Text.Json.JsonSerializer.WriteCore(PooledByteBufferWriter output, Object value, Type type, JsonSerializerOptions options)
at System.Text.Json.JsonSerializer.WriteCoreString(Object value, Type type, JsonSerializerOptions options)
at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options)
at Syncfusion.Blazor.Internal.SfBaseUtils.Equals[T](T oldValue, T newValue)
at Syncfusion.Blazor.SfDataBoundComponent.UpdateProperty[T](String propertyName, T publicValue, T privateValue, Object eventCallback, Expression`1 expression)
at Syncfusion.Blazor.Grids.SfGrid`1.OnHybridParametersSet()
at Syncfusion.Blazor.Grids.SfGrid`1.OnParametersSetAsync()
at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task)