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

Remove all records in Grid with external Button

I need that when I click on an external button, all records in the grid removes. I don't find the function for this. I founded deleteRecord, but for a specific row. I need to delete all records with 1 method. Exists?


1 Reply 1 reply marked as answer

PS Pavithra Subramaniyam Syncfusion Team October 5, 2022 02:38 AM

Hi Luis Guerrero,


Thanks for contacting Syncfusion support.


If you are using local data binding, then you can delete all the Grid rows by using the checkbox selection and Persist Selection in the Grid. So, you can select all the records by clicking the header checkbox and calling the “deleteRecord” method will delete the selected rows. Please refer to the below demo link for more information.


https://ej2.syncfusion.com/javascript/demos/#/bootstrap5/grid/checkbox-selection.html


Or if you want to remove all the rows without deleting action, then you can set the “grid.dataSource” as an empty array. 


 

grid.dataSource =[];

 


Please get back to us if you need further assistance on this.


Regards,

Pavithra S


Marked as answer
Loader.
Live Chat Icon For mobile
Up arrow icon