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

Can Destroy method return more records

3 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
Dan asked on 18 Jul 2018, 06:20 AM

I have a question regarding an implementation.

So I have a table that supports versioning. The user has possibility to view all the versions and also has the possibility to delete the rows.

I have used the Destroy method from the telerik Grid but I have a question. The Destroy method on the demos returns the same list of rows that it was sent. Can this be used to return more rows that were delete than the ones sent?

So for instance let say I have 5 versions of my record in the grid. If I delete one of them can the Destroy method return all 5 records and the grid updates by removing all the 5 rows?

I would like to avoid doing a refresh on the grid. I should mention that I am not using pagination so it wouldn't be a problem.

3 Answers, 1 is accepted

Sort by
0
Accepted
Viktor Tachev
Telerik team
answered on 18 Jul 2018, 10:11 AM
Hello Dan,

By default it is recommended to remove only the records for which the Delete action was triggered. If you would like to have more than one record deleted I suggest using a custom command button. When the button is clicked you can check if there are more records in the Grid with the same version and call remove() method for all relevant items. Then in order to persist the changes to the server call the DataSource sync() method

Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 18 Jul 2018, 10:35 AM

Hi Victor,

I was afraid of your answer that is why I asked first before implementing it. Since I already have a method that deals with the multiple deletion I should also get all the versions of the records and send them to the Destroy method in order to avoid a refresh on all the data.

0
Viktor Tachev
Telerik team
answered on 20 Jul 2018, 08:10 AM
Hello Dan,

The suggested approach would remove the items client-side so that the removed records on the client match the ones on the server. Calling DataSource sync() method will trigger the relevant CRUD operation and that will execute the server-side logic where records are deleted.

Regards,
Viktor Tachev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Viktor Tachev
Telerik team
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or