I have an issue with my radzendatagrid component. When I apply a filter I get an error and I'm not sure how to continue debugging this.
The first error I got is regarding Virtualization:
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit 's0xlwEhWHz8NIQoJxTv-9LSKv3OWdfh8X9Hmqx_edNk'.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Microsoft.AspNetCore.Components.Web.Virtualization.Virtualize`1.BuildRenderTree(RenderTreeBuilder builder)
I thought that maybe filtering doesn't work when Virtualization is enabled so I tried to disable it dynamically when filtering is enabled
However now I get this error:
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
Unhandled exception in circuit '2SpoCEThy91ieob7OsqCsL4fXcLATK6Mj_-TLovuLT8'.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Radzen.QueryableExtension.GetNestedPropertyExpression(Expression expression, String property, Type type)
at Radzen.QueryableExtension.GetExpression[T](ParameterExpression parameter, FilterDescriptor filter, FilterCaseSensitivity filterCaseSensitivity, Type type)
at Radzen.QueryableExtension.Where[T](IQueryable1 source, IEnumerable1 filters, LogicalFilterOperator logicalFilterOperator, FilterCaseSensitivity filterCaseSensitivity)
at Radzen.QueryableExtension.Where[T](IQueryable1 source, IEnumerable1 columns)
at Radzen.Blazor.RadzenDataGrid1.get_View()
at Radzen.PagedDataBoundComponent1.get_PagedView()
at Radzen.Blazor.RadzenDataGrid1.DrawGroupOrDataRows(RenderTreeBuilder builder, IList1 visibleColumns)
at Radzen.Blazor.RadzenDataGrid1.<>c__DisplayClass22_0.<DrawRows>b__0(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder.AddContent(Int32 sequence, RenderFragment fragment)
at Radzen.Blazor.RadzenDataGrid1.<BuildRenderTree>b680_0(RenderTreeBuilder builder2)
at Microsoft.AspNetCore.Components.CascadingValue`1.Render(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
This is my code:
<RadzenDataGrid
@ref="_grid"
ID="@($"grid_{Control.Id}")"
Data="SafeData"
@bind-Value=@Control.SelectedItems
@bind-Settings="@Control.Settings"
LoadSettings="@LoadSettings"
TItem="IDictionary<string, object>"
class="@HiddenCaption"
Style="@style"
AllowFiltering="@Control.ShowFilters"
AllowColumnResize="true"
EmptyText=""
FilterPopupRenderMode="PopupRenderMode.OnDemand"
FilterMode="FilterMode.Advanced"
FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
LogicalFilterOperator="LogicalFilterOperator.Or"
SelectionMode="@Control.RowSelection"
AllowPaging="@Control.AllowPaging"
AllowVirtualization="@(!Control.ShowFilters)"
AllowSorting="@Control.AllowSort"
CellRender="_OnCellRender"
ColRender="_OnColRender"
CellClick="@_OnCellClick"
RowClick="_OnRowClick"
RowDoubleClick="_OnRowDoubleClick"
CellContextMenu="@_OnCellContextMenu">
<HeaderTemplate>
<RadzenLabel TextAlign="TextAlign.Center" Text="@Control.Caption"></RadzenLabel>
</HeaderTemplate>
<Columns>
@foreach (var column in @Control.Columns)
{
<RadzenDataGridColumn
Width="@CololumWidth(column.Value.Width)"
Frozen="@column.Value.Frozen"
Visible="@column.Value.Visible"
@key=@column.Key
Title="@column.Value.Title"
Type="column.Value.TItem"
TextAlign="@column.Value.TextAlign"
FormatString="@column.Value.FormatString"
Property="@column.Key">
<Template>
@if (Control.AllowEdit && !(column.Value.Locked ?? false))
{
<FreematicaEditGridCellTemplate Column="column" Row="context" Control="Control"></FreematicaEditGridCellTemplate>
}
else
{
<FreematicaGridCellTemplate Column="column" Row="context" Control="Control"></FreematicaGridCellTemplate>
}
</Template>
</RadzenDataGridColumn>
}
</Columns>
</RadzenDataGrid>
Any help would be greatly appreciated. I'm using Radzen 6. This same component worked on Radzen 4 but I cannot tell for certain if it broke because of the version change or something else.