Datagrid, Virtualization. Pass data list by [Parameter]

Hi,

I pass a List with data to my component via a [Parameter} and this parameter is used as the data source for Datagrid.

[Parameter]
public List<TItem> Items { get; set; }

<RadzenDataGrid @ref="@grid" TItem="TItem" Data="@Items"..AllowVirtualization="true" .../>

Is it possible to use Virtualization in this case?
Or the download have to be done in the same component?

Items= dbContext.Orders.ToList();

I don’t see any problem in your code. Just a reminder that you need to set height for the DataGrid or the container.

Unfortunately, grid loads only first 50 rows.

<RadzenDataGrid @ref="@grid" TItem="TItem" Data="@Items"
                    AllowFiltering="true" LogicalFilterOperator="LogicalFilterOperator.Or" FilterMode="FilterMode.Advanced" FilterCaseSensitivity="FilterCaseSensitivity.CaseInsensitive"
                    AllowSorting="true" AllowColumnResize="true" AllowColumnReorder="true"
                    AllowVirtualization="true" PageSize="50"
                    RowDoubleClick="args => AddEditDialog(args)" SelectionMode="DataGridSelectionMode.Multiple" @bind-Value=@selectedItems
                    EditMode="DataGridEditMode.Single" RowUpdate="@OnUpdateRow" RowCreate="@OnCreateRow"
                    ExpandMode="DataGridExpandMode.Single"
                    RowRender="@RowRender" CellRender="@CellRender"
                    ColumnWidth="200px" Style="height: calc(100vh - 265px ); width:  calc(100vw - 300px)">

Case 1

var result = await repository.GetAllAsync();
        if (result.Success)
        {
            Items = result.Data;
        }
Case 2:
 [Parameter]
    public List<TItem> Items { get; set; } = new();

The same effect in both cases.
Maybe some properties of the grid preclude the use of virtualization?

Your data should either be IQueryable or you should handle the LoadData event of RadzenDataGrid. Check our virtualization demos.

Is there something wrong with my settings? Unfortunately it does not work :frowning:

image

https://imgur.com/FOJGjYC

Yes, there is. Check my previous reply. Your property is neither IQueryable nor you handle the LoadData event.

Do You mean "Items" property?
(In docs is IEnumerable<>)

Exchange for IQuerable has no effect.

image

Docs
image

It has no effect because you call ToListAsync. Try passing the property without calling ToListAsync.

It wasn't the "Lists" that were the problem...
The problem is Firefox!

Everything is fine in chrome, in firefox - doesn't work...

Thank You for help Korchev.