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

How to exclude a field from an everlive dataSource sync?

2 Answers 48 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
ptw
Top achievements
Rank 1
ptw asked on 11 Nov 2016, 09:42 AM

Hi,
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

-Paul

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 kendo.data.DataSource({
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.    }
12.});

2 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 14 Nov 2016, 03:22 PM
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:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-transport.parameterMap

I hope this can help to achieve the desired result.

Regards,
Stefan
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.
 
0
ptw
Top achievements
Rank 1
answered on 17 Nov 2016, 12:04 PM
Many thanks Stefan.
Tags
Data Source
Asked by
ptw
Top achievements
Rank 1
Answers by
Stefan
Telerik team
ptw
Top achievements
Rank 1
Share this question
or