Process Custom Response from destroy remote service

2 posts, 0 answers
  1. Grant
    Grant avatar
    69 posts
    Member since:
    Jul 2016

    Posted 11 Nov 2016 Link to this post

    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

  2. Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    563 posts

    Posted 14 Nov 2016 Link to this post

    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.
Back to Top