DxTreeList.WaitForRemoteSourceRowLoadAsync(Int32) Method
Returns a task that is completed when the specified row of a remote data source is loaded.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.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
Call the WaitForRemoteSourceRowLoadAsync
method to ensure the specified data row is loaded when the TreeList is bound to the GridDevExtremeDataSource, Custom Data Source, or loads data on demand. For instance, call this method before methods that accept a row’s visible index as a parameter (SelectRow, ExpandRow, and so on).
For multiple rows, use the await Task.WhenAll(…) statement to combine multiple WaitForInstantFeedbackRowLoadAsync
method calls.
The following example focuses a row that is outside the visible range:
@inject CitiesService CitiesService
<DxTreeList @ref="MyTreeList"
Data="@Data"
FocusedRowEnabled="true"
KeyFieldName="ID"
ParentKeyFieldName="ParentID"
HasChildrenFieldName="HasChildren">
<Columns>
<DxTreeListDataColumn Caption="Location" FieldName="Name" />
<DxTreeListDataColumn FieldName="CityType" />
<DxTreeListDataColumn FieldName="Year" DisplayFormat="d"/>
<DxTreeListDataColumn FieldName="RecordType" />
<DxTreeListDataColumn FieldName="Population" />
</Columns>
</DxTreeList>
<DxButton Click="OnFocusRow">Focus the 100th Row</DxButton>
@code {
ITreeList MyTreeList { get; set; }
object Data { get; set; }
protected override async Task OnInitializedAsync() {
var cities = await CitiesService.GetCitiesAsync();
Data = new GridDevExtremeDataSource<Location>(cities.AsQueryable());
}
public async Task OnSelectRow() {
await MyTreeList.WaitForRemoteSourceRowLoadAsync(99);
MyTreeList.SetFocusedRowIndex(99);
}
}