Save new Event on 'addEvent' listener

3 posts, 1 answers
  1. Grant
    Grant avatar
    41 posts
    Member since:
    Jul 2016

    Posted 02 Aug Link to this post

    Hi, 

    To add an event in the Scheduler, a user would double click the time slot where they want to add the event, and the popup would appear for then to do so. Is it possible to skip this step? I'm trying to create functionality so that when a user double clicks a time slot, a new event is auto-generated and saved without any further user interaction required. The new event would have the start and end date/time of the selected slot and 2 dynamically set additional resources, before it can be saved (Im using a customer eventTemplate, so the title is not required). 

    Thanks in advance,

    Grant 

  2. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3706 posts

    Posted 04 Aug Link to this post

    Hello Grant,

    You can accomplish your goal using the Scheduler edit event and SchedulerDataSource API. Basically, in the edit event handler, you would need to:
    • prevent default action (to avoid showing editor form)
    • modify e.event if needed
    • sync the changes using the dataSource instance

    How to use the SchedulerDataSource API is shown in this how-to demo:
    Regards,
    Georgi Krustev
    Telerik by Progress
     
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
     
  3. Kendo UI is VS 2017 Ready
  4. Grant
    Grant avatar
    41 posts
    Member since:
    Jul 2016

    Posted 04 Aug in reply to Grant Link to this post

    I've figured out a round -about way to do this, by triggering the 'saveEvent' when the editable window opens:

    $("#schedule").kendoScheduler({
        editable: {
            window: {
                animation: false,  //Prevents user from seeing the 'add' window
                open: function(e) {

                     //triggers save as soon as the window opens

                    $("#schedule-").data("kendoScheduler").saveEvent(); 
                }
            }
        },
     
        add: function(e) {
            e.event.location = 1;
            e.event.appointmentType = 1;
        }
    });

    If there is a better way to achieve my required result, please say so. I need this functionality to work as efficiently as possible.

    Thanks,

    Grant

  5. Grant
    Grant avatar
    41 posts
    Member since:
    Jul 2016

    Posted 04 Aug in reply to Georgi Krustev Link to this post

    I think Georgi and I were posting at the same time so I didnt see his response before I answered.

    His answer is however a better solution and has been marked as the answer.

    Thanks @Georgi,
    Grant

Back to Top
Kendo UI is VS 2017 Ready