Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
149422 | Nov 26,2019 12:06 AM UTC | Nov 26,2019 09:23 AM UTC | Blazor | 1 |
![]() |
Tags: Grid |
<EjsGrid @ref="GridInstance" AllowPaging="true" DataSource="@Orders" Toolbar="@(new List<string>() { "Cancel", "Update" })">
<GridSelectionSettings Mode="Syncfusion.EJ2.Blazor.Grids.SelectionMode.Both" ></GridSelectionSettings> @*Set the SelectionMode as Both*@
<GridEditSettings AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
<GridEvents CellSelected="CellSelectHandler" TValue="OrdersDetails"></GridEvents> @*Bind CellSelected event*@
...
</EjsGrid>
@code{
public static EjsGrid<OrdersDetails> GridInstance { get; set; }
...
public async void CellSelectHandler(CellSelectEventArgs<OrdersDetails> args)
{
var EditCellIndex = JsonConvert.DeserializeObject<Dictionary<string, object>>(args.CellIndex.ToString());
var CurrentEditCellIndex = 0;
var CurrentEditRowIndex = 0;
foreach (var key in EditCellIndex) //Fetch the currently clicked cell details
{
if (key.Key == "rowIndex")
{
CurrentEditRowIndex = Convert.ToInt32(key.Value); //Fetch the row index
}
if (key.Key == "cellIndex")
{
CurrentEditCellIndex = Convert.ToInt32(key.Value); //Fetch the column index
}
}
var fied = await GridInstance.GetColumnFieldNames(); //Get the name of fields in Grid
GridInstance.EditCell(CurrentEditRowIndex, fied[CurrentEditCellIndex]); //Call the “EditCell” method
}
...
}
|
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.