Skip to main content
A newer version of this page is available. .

DxGrid.WaitForInstantFeedbackRowLoadAsync(Int32) Method

Returns a task that is completed when the specified row of an asynchronous Instant Feedback Data Source is loaded.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v23.1.dll

NuGet Package: DevExpress.Blazor

Declaration

public Task WaitForInstantFeedbackRowLoadAsync(
    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

An Instant Feedback Data Source is designed to work with large data collections. It loads 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 not yet loaded and is located outside the visible range:

@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