4 Answers, 1 is accepted
This happens because the DataSource's Model ID is not specified, which makes it impossible to distinguish new items from existing ones. As a result, all items are treated as new, hence they disappear on clicking the cancel button.
Specifying the ID field should solve the issue, as seen in this example.
Regards,
Alexander Popov
Telerik
I'm able to reproduce the issue using `scheduler.dataSource.add` instead of `scheduler.dataSource.data`. I had to change the logic of my script to:
```
// dataSource.add deletes event on edit -> cancel
var data = dataSource.data();
data.push({
id: event.Id,
title: event.Subject,
start: new Date(event.Start),
end: new Date(event.End),
isAllDay: event.IsAllDay,
AccountAddress: event.AccountAddress,
ContactNames: event.ContactNames,
Status: event.Status
})
dataSource.data(data);
```
Is it expected?
Hi Joshua,
The reported behavior is expected when the add method is used. The Scheduler component treats the newly added events as temporary ones until they are synced. To achieve this, the datasource should be configured with its transport option and a "create" endpoint should be added.
Talking about the data method, it generally changes the dataSource of the component. This is why an event is not disappearing when added using this method.
What I can suggest as an alternative to the "add" method is to use pushCreate instead. This Dojo example demonstrates how the mentioned method can be used.
Regards,
Petar
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.