Bug - event disappears after double click when using data source

6 posts, 0 answers
  1. Pawel
    Pawel avatar
    22 posts
    Member since:
    Oct 2014

    Posted 04 Dec 2014 Link to this post

    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
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1444 posts

    Posted 08 Dec 2014 Link to this post

    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!
     
  3. Pawel
    Pawel avatar
    22 posts
    Member since:
    Oct 2014

    Posted 09 Dec 2014 in reply to Alexander Popov Link to this post

    Hi Alexander

    Thanks. This solved the problem.

    Regards,

    Pawel
  4. Joshua
    Joshua avatar
    3 posts
    Member since:
    May 2015

    Posted 30 Jun 2020 in reply to Alexander Popov Link to this post

    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?

     

  5. Joshua
    Joshua avatar
    3 posts
    Member since:
    May 2015

    Posted 30 Jun 2020 in reply to Joshua Link to this post

    Here's the scheduler.dataSource.add dojo: http://dojo.telerik.com/eQokaQAG
  6. Petar
    Admin
    Petar avatar
    438 posts

    Posted 02 Jul 2020 Link to this post

    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.
Back to Top