How to exclude a field from an everlive dataSource sync?

3 posts, 0 answers
  1. ptw
    ptw avatar
    27 posts
    Member since:
    Sep 2015

    Posted 11 Nov 2016 Link to this post

    I have a data model for an everlive datasource, and I've added some extra fields that help manage some functions around what is displayed in a ListView. However I don't want the extra field saved back to the dataSource when it is synced.

    I've sketched what I thought might work below. Am I on the right track? And/or what sort of code would I need to ensure the showAnimalDetails is not saved?

    Many thanks


    In the following, the animalName is from the dataSource and the showAnimalDetails is an extra field.

    01.var animalModel = {
    02.    id: 'Id',
    03.    fields: {
    04.        animalName: {
    05.            field: 'animalName'
    06.        },
    07.        showAnimalDetails: {
    08.            defaultValue: false
    09.        }
    10.    ...


    That all works fine. However, I don't want to include the showAnimalDetails field when I sync the dataSource back via Everlive. 

    I thought the way to do it would be like this ...

    01.var animalsDataSource = new{
    02.    type: 'everlive',
    03.    schema: {
    04.        model: animalModel
    05.    },
    06.    transport: {
    07.        typeName: 'Animals',             
    08.        update: function(options) {
    09.            // Put code here to remove extra field before sync?
    10.        }
    11.    }
  2. Stefan
    Stefan avatar
    1273 posts

    Posted 14 Nov 2016 Link to this post

    Hello Wilson,

    If the desired result is to not send some of the fields to the server, I can suggest using the parameterMap property of the DataSource. This is a function which can be used to modify the request parameters before sending them to the server:

    I hope this can help to achieve the desired result.

    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.
  3. ptw
    ptw avatar
    27 posts
    Member since:
    Sep 2015

    Posted 17 Nov 2016 in reply to Stefan Link to this post

    Many thanks Stefan.
Back to Top