RadzenGrid virtualization - no rows with LoadData

Hi,

I'm trying to enable virtualization on the radzengrid (Radzen Blazor 4.1.9)

If I have LoadData handler declared, no data appears in the grid. If the handler is removed, I can see all the bound records.

Any particular reason? Am I missing something?

A.

Most probably you’ve not set Count - check our demo for reference.

thank you for a speedy response!

Thanks for pointing me to the Count property setting on the grid.
Now I have the records rendered in the grid, but, out of 500 records I'm only getting 20.
The LoadData callback is triggered but what I can see in the args parameter is that Skip is always set to 0 and args.Top set to 18

Not quite sure what I'm doing wrong.

   <RadzenDataGrid TItem="RowViewModel"
                    ExpandMode="DataGridExpandMode.Single"
                    AllowVirtualization="true"
                    Data="@_rowViewModels"
                    LoadData="@LoadData"
                    Count="@_recordCount"
                    AllowFiltering="true">
... ... ... ... 

    private IEnumerable<RowViewModel> _rowViewModels;
    private int _recordCount;
    
    private void LoadData(LoadDataArgs args)
    {
        if (!string.IsNullOrEmpty(args.Filter))
        {
            ViewModel.ApplyFilter(args.Filter);
        }
        else
        {
            ViewModel.ApplyFilter(string.Empty);
        }
        _rowViewModels = ViewModel.FilteredRows
            .Skip(args.Skip.Value)
            .Take(args.Top.Value)
            .ToList();
        _recordCount = _rowViewModels .Count();
    }

I assume this might be related to this issue ?
datagrid-virtualization-loaddata bug with many rows · Issue #653 · radzenhq/radzen-blazor · GitHub

The Count should be set to total records count not the count of requests items. You’ve missed also to specify height. I strongly recommend you to check carefully our demo.

Thank you once again. When trying to set the filter on the grid following exception is thrown and grid becomes unresponsive. This happens when I enabled filtering and started filtering the set..

WARN 2023-01-26 18:08:40.2641 [ 32] Server.Circuits.RemoteRenderer | Unhandled exception rendering component: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state.
System.InvalidOperationException: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state.
at Microsoft.AspNetCore.Components.Web.Virtualization.Virtualize1.BuildRenderTree(RenderTreeBuilder builder) at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException) ERROR 2023-01-26 18:08:40.2923 [ 32] ts.Server.Circuits.CircuitHost | Unhandled exception in circuit 'PUFMRwEGCP0oQ-IbdTFmKYTFCj99SQvJAK1bcZNPdPU'. System.InvalidOperationException: The current thread is not associated with the Dispatcher. Use InvokeAsync() to switch execution to the Dispatcher when triggering rendering or component state. at Microsoft.AspNetCore.Components.Web.Virtualization.Virtualize1.BuildRenderTree(RenderTreeBuilder builder)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)