Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
147367 | Sep 7,2019 09:27 PM UTC | Sep 16,2019 03:39 AM UTC | Blazor | 6 |
![]() |
Tags: Grid |
<EjsGrid @ref="gridInstance" AllowSelection="true" DataSource="@Orders" Height="315">
<GridEvents OnDataBound="DataBoundHandler" TValue="Order"></GridEvents>
...
</EjsGrid>
public async void DataBoundHandler(BeforeDataBoundArgs<Order> args)
{
await Task.Delay(200);
string myDynamicJSON = "[{rowIndex: 0, cellIndexes:[1]},{rowIndex: 2, cellIndexes:[2,3]}]";
this.gridInstance.SelectCells((IEnumerable<object>)JsonConvert.DeserializeObject(myDynamicJSON));
}
|
<EjsGrid AllowSelection="true" ...>
<GridEvents OnLoad="OnLoad" RowSelected="RowSelected" TValue="Order"></GridEvents>
...
</EjsGrid>
@code{
...
public bool flag = false;
public void OnLoad()
{
this.flag = true;
}
public void RowSelected(RowSelectEventArgs<Order> args)
{
if (this.flag)
{
//perform actions during initial load selection
this.flag = false;
}
else
{
//perform actions after loading during manual selection
}
}
...
}
|
<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);
}
...
} |
public async void DataBoundHandler(BeforeDataBoundArgs<Order> args)
{
await Task.Delay(200);
var PrimayIndex = await this.GridInstance.GetRowIndexByPrimaryKey(1006); //Based on primarykey value fetch index
this.GridInstance.SelectRow(PrimayIndex); //Use the index to select row
}
|
public async void click() //As an example, we have used the button click to call GetSelectedRecords method
{
var SelectedRecords = await this.gridInstance.GetSelectedRecords(); //Fetch the selected records
var FirstRowPrimaryValue = SelectedRecords[0].OrderID; //Here you can fetch the primary key value of your selected row.
}
|
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.