|
<button @onclick="Select">Select</button>
<SfGrid @ref="Grid" DataSource="@Orders" AllowSelection="true" AllowPaging="true">
<GridSelectionSettings Type="SelectionType.Multiple"></GridSelectionSettings>
<GridColumns>
<GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn>
. . .
</GridColumns>
</SfGrid>
@code{
SfGrid<Order> Grid;
public List<Order> Orders { get; set; }
. . .
public async Task Select()
{
await Task.Delay(1000);
await Grid.SelectRow(0); //it will select the particular row after 1 second
await Task.Delay(1000);
await Grid.SelectRow(1); // it will select the particular row after 2 seconds
await Task.Delay(6000);
await Grid.SelectRow(2); // it will select the particular row after 8 seconds
await Task.Delay(5000);
await Grid.SelectRow(3); // it will select the particular row after 13 seconds
await Task.Delay(2000);
await Grid.SelectRow(4); // it will select the particular row after 15 seconds
}
} |
|
<button @onclick="Select">Select</button>
<SfGrid @ref="Grid" DataSource="@Orders" AllowSelection="true" AllowPaging="true">
<GridSelectionSettings Type="SelectionType.Multiple"></GridSelectionSettings>
<GridColumns>
. . .
</GridColumns>
</SfGrid>
@code{
SfGrid<Order> Grid;
public List<Order> Orders { get; set; }
public List<double> Indexes { get; set; } = new List<double>();
. . .
public async Task Select()
{
Indexes.Add(0);
await Task.Delay(1000);
await Grid.SelectRows(Indexes.ToArray());
Indexes.Add(1);
await Task.Delay(1000);
await Grid.SelectRows(Indexes.ToArray());
Indexes.Add(2);
await Task.Delay(6000);
await Grid.SelectRows(Indexes.ToArray());
Indexes.Add(3);
await Task.Delay(5000);
await Grid.SelectRows(Indexes.ToArray());
Indexes.Add(4);
await Task.Delay(2000);
await Grid.SelectRows(Indexes.ToArray());
}
} |