<EjsGrid @ref="GridInstance" AllowSelection="true" AllowPaging="true" DataSource="@Orders" Height="315">
<GridEvents OnDataBound="DataBoundHandler" TValue="Order"></GridEvents>
<GridSelectionSettings Mode="SelectionMode.Row" Type="SelectionType.Multiple"></GridSelectionSettings> @*By default the selection Mode will be Row*@
...
</EjsGrid>
@code{
...
public async void DataBoundHandler(BeforeDataBoundArgs<Order> args)
{
await Task.Delay(200);
this.GridInstance.GoToPage(2);
this.GridInstance.SelectRow(4);
}
...
}
|
<EjsGrid @ref="GridInstance" ModelType="@Model" AllowSelection="true" AllowPaging="true" DataSource="@Orders">
<GridEvents DataBound="DataBoundHandler" TValue="Order"></GridEvents>
<GridPageSettings PageSize="@PageSize" CurrentPage="@CurrentPage"></GridPageSettings>
. . . .
</EjsGrid>
@code{
public List<Order> Orders { get; set; }
EjsGrid<Order> GridInstance;
public int CurrentPage,RecordIndex,TotalPage;
public int PageSize = 5;
public Order Model = new Order();
protected override void OnInitialized()
{
. . . . ..
RecordIndex = 25 % PageSize;
TotalPage = 25 / PageSize;
CurrentPage = TotalPage + 1;
}
public async void DataBoundHandler()
{
this.GridInstance.SelectRow(RecordIndex);
}
}
|