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

custom delete implementation

Hi, currently when I click the "delete" option on the toolbar, it only removes from the grid. How can I write my own handler for delete? I want to trigger an API call when trying to delete a record. I tried using click handler to define my own toolbar item, but it looked like too much. 

3 Replies

TS Thiyagu Subramani Syncfusion Team September 3, 2019 10:35 AM UTC

 Hi Jose, 
Greetings from Syncfusion support. 
Thanks for your patience. 
We have analyzed the reported query “custom delete implementation” at our end. 
Using deleteRecord method, we have achieved your requirement at our end.  Here deletion happened only after a required grid data was selected. 
Please refer this below code example.  
BtnClick() { 
<button class='e-btn' (click)="BtnClick()">Delete</button> 
Refer the help documentation: 
Please check the sample/documentation link and get back to us, if you require any further assistance on this. 
Thiyagu S 

JL jose lara September 3, 2019 02:30 PM UTC

Hi Thiyagu, thx for your response. I don't want to add a separate delete button as shown in your example. I want to be able to use the existing delete button on the toolbar and then write my own implementation for it.

BS Balaji Sekar Syncfusion Team September 4, 2019 01:13 PM UTC

Hi Jose, 

Based on your query, we have modified a sample with your requirement and you can able to write your own implementation while we do delete action using “toolbarClick” event of EJ2 Grid. please refer the below code example and sample for more information. 
<ejs-grid #grid id="grid" [dataSource] = 'data'(toolbarClick) = "toolbarClick($event)" [editSettings] = 'editSettings'[toolbar] = "toolbar" height = '300px' > 
      .     .     .     . 
      </e-columns > 

toolbarClick(args) { 
        if (args.item.id == "grid_delete") { 
            // Write Your code here 

Balaji Sekar. 

Live Chat Icon For mobile
Up arrow icon