Skip to main content
All docs
V25.1
  • 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.v25.1.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 WaitForRemoteSourceRowLoadAsync 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 WaitForRemoteSourceRowLoadAsync method calls.

    The following example selects 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.WaitForRemoteSourceRowLoadAsync(100);
            MyGrid.SelectRow(100);
        }
    
        public void Dispose() {
            InstantFeedbackSource?.Dispose();
            Northwind?.Dispose();
        }
    }
    
    See Also