This is a migrated thread and some comments may be shown as answers.

How to delete all record from DataSource without looping?

2 Answers 142 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Ambica
Top achievements
Rank 1
Ambica asked on 15 Mar 2013, 12:07 PM
Hi all,

I am wondering is there any method to remove all record from dataSource ? and then sync(), so that it'll clear all record from DB .

Have scenario like i want to delete 500 records then add 20 - 30 records. I can do it with loop it causing delay. 

Please help me out

Thanks in Advance

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 18 Mar 2013, 07:22 AM
Hello Ambica,

 Currently the Kendo DataSource doesn't provide any API fore deleting all records. Looping is the only supported way.

Regards,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Brett
Top achievements
Rank 2
answered on 22 Mar 2013, 03:33 PM
You could set the DataSource batch mode to true. That way all of your deleted records are sent in one request to the server. And then all of your added records are sent in a separate request to the server. Then on the server-side you would have to loop through each record to add/remove them from your data store. The benefit here is that the looping is done on the server, and since the requests are asynchronous, the client is not held up.
Tags
Data Source
Asked by
Ambica
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Brett
Top achievements
Rank 2
Share this question
or