We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Data Grid Delete

I want to delete a row from data grid, but also from my database, what is the event to handle delete function, or how can i get the id of the row which i am deleting?

1 Reply

PS Pavithra Subramaniyam Syncfusion Team May 28, 2019 04:34 AM UTC

Hi sayali , 

Thanks for contacting Syncfusion support. 

You can achieve your requirement by using the “actionBegin” or “actionComplete” event of Grid component with requestType ‘delete’. Please refer to the below code example, documentation link and sample link for more information. 

[App.Vue] 
<template> 
  <div id="app"> 
    <ejs-grid  ref="grid"  id="grid" :dataSource="data" :editSettings="editSettings" :toolbar="toolbar" 
      :actionBegin="actionBegin" > 
      <e-columns> 
       .  . 
      </e-columns> 
    </ejs-grid> 
  </div> 
</template> 

<script> 

export default { 
  name: "App", 
   .  .  .   
  methods: { 
    actionBegin: function(e) { 
      if (e.requestType === "delete") { 
        console.log("delete"); 
        //getting the primary key field name 
        var primaryKeyField = this.$refs.grid.ej2Instances.getPrimaryKeyFieldNames()[0]; 
        var id = e.data[0][primaryKeyField]; 
        console.log(id); 
     
   
 
}; 
</script> 

                               https://ej2.syncfusion.com/vue/documentation/api/grid/#actioncomplete 
                              https://ej2.syncfusion.com/vue/documentation/api/grid/deleteEventArgs/ 

Sample               : https://codesandbox.io/s/vue-template-q69vg  

Please get back to  us if you need any further assistance on this. 
 
Regards,  
Pavithra S. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon