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

Process Custom Response from destroy remote service

1 Answer 109 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Grant asked on 11 Nov 2016, 07:02 AM

Hi, 

I have a DataSource thats performing CRUD for a grid of data. However in my destroy service when a data item is 'deleted', its either deleted or deactivated. My service can return a string, but then the DS 'requestEnd' event doesnt register the destroy response because the response is not the original object or blank.

I need a way for my service to communicate in the response whether a record was deleted or deactivated, Please advise.

Thanks and kind Regards,
Grant

1 Answer, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 14 Nov 2016, 12:57 PM
Hello Grant,

In order to ensure that the DataSource is properly tracking which items have been removed, the response should be either empty, or contain the removed items.

There are two possible approaches to achieve the desired behavior:

1) Modify the remote service to return a complex object with a "data" field, "total" field, and a custom field for the deleted/deactivated string, and use the dataSource.schema option to specify the data and total fields. Then you will be able to access the custom field of the response in the requestEnd handler.

2) Use custom transport to gain full control of the data flow, and perform the necessary custom logic in the provided function before calling options.success(options.data).

Further information about configuring a custom transport is available in the following section of our documentation:

http://docs.telerik.com/kendo-ui/framework/datasource/crud#local-or-custom-transport-crud-operations

I hope this helps.

Regards,
Dimiter Topalov
Telerik by Progress
Build rich, delightful, *native* Angular 2 apps with Kendo UI for Angular 2. Try it out today! Kendo UI for Angular 2 (currently in beta) is a jQuery-free toolset, written in TypeScript, designed from the ground up to offer true, native Angular 2 components.
Tags
Data Source
Asked by
Grant
Top achievements
Rank 3
Iron
Iron
Veteran
Answers by
Dimiter Topalov
Telerik team
Share this question
or