I have a datasource binding to remote data. The model of remote data has many fields. I found that if I do not define schema.model.fields, all fields from remote will be processed, while if I define it, only data in defined fields will be processed. I just want to define part of remote fields, let other fields be defaults.
ds = new kendo.data.DataSource({
schema: {
model: {
id: 'UID',
fields: {
UID: { type: 'number', defaultValue: -1 }
// Can I ignore other 20+ fields?
}
},
},
transport: {
read: '/Path/To/ReadData',
create: ...,
update: ...
}
}
The reason I want to do so is, when I add an item to the datasource then sync, the create action is not triggered. I debugged into source code and found that for the new item, its status is not 'created' since my default value -1 is not equal to "default" defaultValue of ""(empty string). So I think if I could define the id field and ignore other fields, this could be resolved. I know I can define all fields to make it work, but those other fields I don't care. For now, as a workaround, I have to set the id of new item to empty string to make create new item working.
Thanks,
Lei
ds = new kendo.data.DataSource({
schema: {
model: {
id: 'UID',
fields: {
UID: { type: 'number', defaultValue: -1 }
// Can I ignore other 20+ fields?
}
},
},
transport: {
read: '/Path/To/ReadData',
create: ...,
update: ...
}
}
The reason I want to do so is, when I add an item to the datasource then sync, the create action is not triggered. I debugged into source code and found that for the new item, its status is not 'created' since my default value -1 is not equal to "default" defaultValue of ""(empty string). So I think if I could define the id field and ignore other fields, this could be resolved. I know I can define all fields to make it work, but those other fields I don't care. For now, as a workaround, I have to set the id of new item to empty string to make create new item working.
Thanks,
Lei