Row data of ActionEventArgs OnActionComplete for Grids.Action.Save are null

I am trying to implement inline editing for Grid control flowing this demo.  
https://blazor.syncfusion.com/demos/Grid/CommandColumn?theme=bootstrap4

What I am trying to is to handle save event so I can send updates back to db.
My problem is that I can't get updated data in OnActionComplete event.
When user click command save in row OnActionComplete event get triggered.
I get args with RequestType set to   Grids.Action.Save but Args has no Data param set and I can't find updated data.

Is there some other even wich contains updated data of row when user click save command.

3 Replies

VN Vignesh Natarajan Syncfusion Team March 16, 2020 04:02 AM UTC

Hi Admir,  
 
Thanks for contacting Syncfusion forums. 
 
Query: “Is there some other even wich contains updated data of row when user click save command. 
  
We suggest you to achieve your requirement using OnActionBegin event of the Grid when RequestType is Save instead of OnActionComplete event. You can get the updated / inserted record details in the event arguments of OnActionBegin event.  
 
Refer the below code example.  
 
<EjsGrid DataSource="@Orders"> 
    <GridEvents OnActionBegin="ActionBeginHandler" TValue="Order"></GridEvents> 
</EjsGrid> 
  
@code{ 
     public void ActionBeginHandler(ActionEventArgs<OrderArgs) 
    { 
        if(Args.RequestType == Syncfusion.EJ2.Blazor.Grids.Action.Save) 
        { 
            Args.Data; // returns current edtred / inserted record detail. 
        } 
    }  
} 
 
  
Refer our UG documentation for your reference 
 
 
Kindly get back to us if you have further queries.  
 
Regards, 
Vignesh Natarajan. 



AH Admir Hodžic May 4, 2020 09:04 AM UTC

Thank you , on your support, my apologies for late answer, 
 ActionBeginHandler wokring.
May I ask you for help:
Is there a way to cancel update, in some case I do server side verification of data, and sometime I do not want to row be update.
Is there something like commit parameter, which I shoud return upon save.

How I can cancel saving (update) of grid ?



VN Vignesh Natarajan Syncfusion Team May 5, 2020 07:35 AM UTC

Hi Admir,  
 
Thanks for contacting Syncfusion support.  
 
Query: “Is there a way to cancel update, in some case I do server side verification of data, and sometime I do not want to row be update. 
 
We suggest you to achieve your requirement using OnActionBegin event of the Grid. We can prevent the default operation of Grid by enabling the Cancel property in the event arguments. Refer the below code example 
 
@using Syncfusion.Blazor.Grids <SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add""Edit""Delete""Cancel""Update" })" Height="315">    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>    <GridEvents OnActionBegin="ActionBegin"  TValue="Order"></GridEvents>. . . .. . . . . . .</SfGrid> @code{    public List<Order> Orders { getset; }    SfGrid<Order> Grid { getset; }    public bool Flag = true;    public async Task ActionBegin(ActionEventArgs<Order> args)   {       if (args.RequestType == Syncfusion.Blazor.Grids.Action.Save)       {           if (Flag)           {               args.Cancel = true// prevent the default action;               await Task.Delay(100);  // to perform valdiation in server               if (true)               //perform validation and if validation success               {                   Grid.EndEdit(); // save the changes                   Flag = false;                }               else               {                   Grid.CloseEdit(); // cancel the editing                   Flag = true;               }           }        } }
 
 
Refer our UG documentation for your reference 
 
 
Kindly get back to us if you have further queries.  
 
Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon