Skip to main content
All docs
V23.2

DxGrid.WaitForRemoteSourceRowLoadAsync(Int32) Method

Returns a task that is completed when the specified row of an asynchronous remote data source is loaded.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.2.dll

NuGet Package: DevExpress.Blazor

Declaration

public Task WaitForRemoteSourceRowLoadAsync(
    int visibleIndex
)

Parameters

Name Type Description
visibleIndex Int32

The row’s visible index.

Returns

Type Description
Task

The task that is completed when the row is loaded.

Remarks

The following data sources are designed to work with large data collections:

They load data asynchronously in small portions on demand (instead of the entire dataset).

Call the WaitForInstantFeedbackRowLoadAsync method to ensure that the specified data row is loaded. For instance, call this method before those that accept a row’s visible index as a parameter (SelectRow, StartEditRowAsync, and so on).

For multiple rows, use the await Task.WhenAll(…) statement to combine multiple WaitForInstantFeedbackRowLoadAsync method calls.

The following example demonstrates how to select a row that is outside the visible range and not yet loaded:

@using Microsoft.EntityFrameworkCore
@using DevExpress.Data.Linq
@inject IDbContextFactory<NorthwindContext> NorthwindContextFactory
@implements IDisposable

<DxGrid Data="InstantFeedbackSource"
        AllowSelectRowByClick="true"
        KeyFieldName="OrderId"
        @ref="MyGrid"> 
    <Columns>
        <DxGridDataColumn FieldName="ShipName" />
        <DxGridDataColumn FieldName="ShipCity" />
        <DxGridDataColumn FieldName="ShipCountry" />
        <DxGridDataColumn FieldName="Freight"  />
        <DxGridDataColumn FieldName="OrderDate" />
        <DxGridDataColumn FieldName="ShippedDate" />
    </Columns>
</DxGrid>

<DxButton Click="OnSelectRow">Select Row 100</DxButton>

@code {
    EntityInstantFeedbackSource InstantFeedbackSource { get; set; }
    NorthwindContext Northwind { get; set; }
    IGrid MyGrid { get; set; }

    protected override void OnInitialized() {
        Northwind = NorthwindContextFactory.CreateDbContext();
        InstantFeedbackSource = new EntityInstantFeedbackSource(e => {
            e.KeyExpression = "OrderId";
            e.QueryableSource = Northwind.Orders;
        });
    }

    public async Task OnSelectRow() {
        await MyGrid.WaitForInstantFeedbackRowLoadAsync(100);
        MyGrid.SelectRow(100);
    }

    public void Dispose() {
        InstantFeedbackSource?.Dispose();
        Northwind?.Dispose();
    }
}
See Also