Bug? - Cancel button in event edit window is removing event

11 posts, 0 answers
  1. AceRoute GL
    AceRoute GL avatar
    3 posts
    Member since:
    Jan 2014

    Posted 16 Jan 2014 Link to this post

    Hi - I have commercial license for Web UI

     I am not sure why id field is not getting populated. Please refer to code below.

    It does add event which shows up on Scheduer and if I double-click the event it opens-up the edit window with fields correctly populated. If I select "Save" or "Delete", everything works fine but selecting "Cancel" will remove event. Seems like id field is not getting populated but I can't figure out what am I doing wrong..


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <link href='../css/kendo.common-bootstrap.css' rel='stylesheet'>
        <link href='../css/kendo.flat.css' rel='stylesheet'>
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
        <script src="http://cdn.kendostatic.com/2013.3.1119/js/kendo.all.min.js"></script>
    </head>
        
    <body>
        <div id="scheduler"></div>
        
        <script>
            $("#scheduler").kendoScheduler({
                  date: new Date("2014/01/06"),
                  dataSource: {
                schema: {
                    model: {
                        id: "id",
                        fields: {
                            id: {type: "number"},
                            start: {type: "date"},
                            end: {type: "date"},
                            title: {field: "Title"},
                            description: {field: "Description"}
                       }
                    }
                }
                }
            });
            scheduler = $("#scheduler").data("kendoScheduler");
            
            scheduler.dataSource.add({                
            id: 1,
            start: new Date("2014/01/06 10:30"),
            end: new Date("2014/01/06 11:30"),
            title: "test",
            description: "test"
            });
        
            scheduler.view(scheduler.view().name);
        </script>
    </body>
    </html> 
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 20 Jan 2014 Link to this post

    Hello,

    This behavior is expected, because clicking the cancel button reverts all changes. In this case however, the array containing the pristine data is empty, so the event disappears. I would recommend configuring the dataSource.transport correctly and calling the dataSource.sync method after the new event was added through dataSource.add. Additionally, if a dataSource item has an ID the Update method will be called, and if the ID is empty - the Create method will be called when the sync occurs. 

    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. Kendo UI is VS 2017 Ready
  4. Andrey
    Andrey avatar
    1 posts
    Member since:
    Jun 2015

    Posted 11 Jun 2015 in reply to Alexander Popov Link to this post

    dataSource initialized with ARRAY

    Array contains items with ID

    I open existing event and press Cancel

    Oooops... event disappeared... so expected

  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 15 Jun 2015 Link to this post

    Hello Andrey,

    Would you please share some code snippets or a Dojo example that we can examine?

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Joseph
    Joseph avatar
    4 posts
    Member since:
    Jan 2016

    Posted 23 Feb Link to this post

    Hello Alexander,

    This doesn't sound like something expected, take a look at your demo:
    http://demos.telerik.com/kendo-ui/scheduler/restriction

    Add an event and save it, after, re-edit and click on cancel.
    Why the event disappear?  

  7. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 25 Feb Link to this post

    Hi Joseph,

    The demo illustrates how to restrict certain actions and uses mock-up data for that purpose. The Scheduler is not configured to perform actual CRUD operations, hence the disappearing events. This is related to the lack of DataSource transport. I would recommend checking basic usage demo instead and the Scheduler documentation.

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  8. Joseph
    Joseph avatar
    4 posts
    Member since:
    Jan 2016

    Posted 02 Mar in reply to Alexander Popov Link to this post

    Hi Alexander,

    Yes, I know what the demo illustrates, but I mentioned that to illustrate my point of view.
    I tested many of your demos and for local data array this problem remains.

    This is related to the lack of DataSource transport, ok but when this is bind to remote service, as specified in the doc, no? 
    And what about local array with local DataSource? There's no transport configured.

    In your demos and documentations, the focus is on DataSource transport with remote services or I missed something.

     

    Regards,

    joseph

  9. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 04 Mar Link to this post

    Hi Joseph,

    I am afraid that your last post is unclear. Do you need any further assistance with a case of yours? If this is so, then please open a support ticket that includes an example of the problem you are facing. Thank you in advance. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  10. Joseph
    Joseph avatar
    4 posts
    Member since:
    Jan 2016

    Posted 04 Mar Link to this post

    Hi Petyo,

    My case doesn't matter, I try to understand how to manage local javascript data array in your demos.
    And what I see it's:
    When a new event is added in the scheduler, we can't re-edit it, otherwise, on cancellation of edit window, it's removed.

    After investigation, events are added to the _data property of the scheduler.
    In use with a datasource transport when saved, it's added to _pristinedata property of the scheduler, and all work fine.
    But with local data array and without datasource transport the event isn't never added to the _pristinedata.


    That's all I have to say about that. natively the scheduler doesn't add event correctly in local data.


    joseph
  11. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 08 Mar Link to this post

    Hello joseph,

    Your observation is correct. The widget (the DataSource in particular) is designed to keep the newly created models/events when they are synced. The models are considered synced when they have a unique valid ID values. In other cases, the events are consided temporary and will be removed when cancelChanges is called. This is exactly what happens when "Cancel" button is clicked.

    I would suggest you examine the Editing fundamentals help topic, which explains how the editing functionality is accomplished in Kendo UI widgets:
    Basically, in this case you will need to update the Ids on create. Here is a simple Dojo demo that demonstrates one possible approach:
    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  12. Joseph
    Joseph avatar
    4 posts
    Member since:
    Jan 2016

    Posted 09 Mar in reply to Georgi Krustev Link to this post

    Hello Georgi,

    Thank you for your demo, it helped me understand things better.
    Now it is clear to use local data array, we need to use also a datasource transport.

    Many thanks for your support.

    joseph

     

Back to Top
Kendo UI is VS 2017 Ready