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

Batch Delete in Data Grid

How can i do batch delete in Data Grid? Also how can i select multiple rows in data grid and get id's of all those selected rows?

1 Reply

HJ Hariharan J V Syncfusion Team May 30, 2019 12:39 PM UTC

Hi Sayali, 

Thanks for contacting Syncfusion support. 

Query #1: How can i do batch delete in Data Grid? 

We suggest you to set edit mode as “Batch” in Grid editSettings property to perform the batch add, batch delete and batch update action in Grid. You can set the edit mode as “Batch” like as below code snippet, 

editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true, mode: "Batch" } 

We have already discussed about this topic in our help documentation. So please refer the  below documentation link to know more details about Grid batch editing, 


Query #2:  Also how can i select multiple rows in data grid 

We suggest to set type as “Multiple” in Grid selectionSettings property to enable the multiselect option. You need use “Ctrl + mouse left click” to perform the multi selection in Grid. 

selectionOptions: { type: "Multiple" } 


Query #3: get id's of all those selected rows? 

We suggest to use the Grid getSelectedRecords method to get the selected records details. Please refer the below code snippet, 

btnClick: e => { 
        var grid = document.getElementById("Grid").ej2_instances[0]; 
        var selectedRecords = grid.getSelectedRecords(); 
        alert(JSON.stringify(selectedRecords)); 
    } 

Also, we would like to inform that getSelectedRows and getSelectedRowIndexes methods of the Grid. This methods are used to find the selected row elements and find the selected row indexes. Please refer the below documentation links to know more details about this methods, 


 
 
We have prepared the sample this requirement and you can find that sample from the below link for further assistance, 


Regards, 
Hariharan 


Loader.
Live Chat Icon For mobile
Up arrow icon