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

Save new Event on 'addEvent' listener

3 Answers 215 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Grant asked on 02 Aug 2016, 02:45 PM

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 

3 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 04 Aug 2016, 09:08 AM
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.
 
0
Grant
Top achievements
Rank 3
Iron
Iron
Iron
answered on 04 Aug 2016, 09:11 AM

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

0
Grant
Top achievements
Rank 3
Iron
Iron
Iron
answered on 04 Aug 2016, 09:19 AM

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

Tags
Scheduler
Asked by
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Answers by
Georgi Krustev
Telerik team
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Share this question
or