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

Bug - event disappears after double click when using data source

4 Answers 341 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
COLIN
Top achievements
Rank 1
COLIN asked on 04 Dec 2014, 05:20 PM
Hello

Please check this demo: http://dojo.telerik.com/IziME/15
If you double click the event, and click "cancel", the event disappears.

Regards,

Pawel

4 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 08 Dec 2014, 12:38 PM
Hi Pawel,

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Joshua
Top achievements
Rank 1
answered on 30 Jun 2020, 02:18 PM

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?

 

0
Joshua
Top achievements
Rank 1
answered on 30 Jun 2020, 02:19 PM
Here's the scheduler.dataSource.add dojo: http://dojo.telerik.com/eQokaQAG
0
Petar
Telerik team
answered on 02 Jul 2020, 09:08 AM

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

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Scheduler
Asked by
COLIN
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Joshua
Top achievements
Rank 1
Petar
Telerik team
Share this question
or