How can I add any value in the "actionBegin" callback ?

Hi again!

In the below image you can see I add a new row.




In the next image there is a new row with a Customer ID that  I didn't type.


However, if I edit this row, the Customer ID value just dissapear, as you can see in the below image.


In addition, here you have the sample that I did: http://jsplayground.syncfusion.com/v3z514tq

I would like to save this Customer ID value that it is added in the actionBegin callback.

I will be awating for your reply, thanks in advance.

Regards, Luis Carlos.

3 Replies

VN Vignesh Natarajan Syncfusion Team October 31, 2017 03:28 PM UTC

Hi Luis, 

Thanks for using Syncfusion support. 

We have analyzed your query and we suspect that you want to specify the value to column while adding a record. We have achieved your requirement using actionBegin event of the Grid.  

Please refer the below code snippet 

actionBegin:function(args){ 
                    if(args.requestType =="save"){ 
                         args.data["CustomerID"] = "it will not disappear"; 
                } 
                }, 

Pleaser refer the below screenshot for the output  

 
While adding a record 
 
 
Editing a Added record 

Refer the below link for the JSplayground sample 


If we misunderstood your query, please get back to us with more details. 

Regards, 
Vignesh Natarajan 



LC Luis Carlos November 8, 2017 05:50 PM UTC

Hi again.

Maybe I didn't explain well, let me try again, please.

I need empty the "args.data" variable (args.data = {};), after that, I would like to save again the information inserted by the user, and overwrite the value "it will not disappear" in the key "args.data.CustomerID" ( args.dataCustmerID = "it will not desappear"; ).

Once it saves, the "ejGrid" component shows the value "it will not disappear". However if I edit this row, the CustomerID field shows what the user inserted, it must show the value "it will not disappear".


Here I let you a sample in order to have a better understanding of this situation. 

http://jsplayground.syncfusion.com/lpirshz5


I will be awaiting for your reply, thanks again.

Regards, Luis.



VN Vignesh Natarajan Syncfusion Team November 9, 2017 04:35 PM UTC

Hi Luis, 

We cannot update the value of the record by cloning it by extend method. So, we suggest you to use the solution that we mentioned in previous update. Please explain your requirement clearly.  

  1. Purpose of need empty args.data variable.
  2. Give the Video demonstration of your requirement. 
 
Regards, 
Vignesh Natarajan 


Loader.
Up arrow icon