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

Create Event Programmatically

4 Answers 491 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Reafidy
Top achievements
Rank 1
Reafidy asked on 13 Jun 2017, 03:24 AM

I have the scheduler set to timelinemonth view.  I would like to create events in the scheduler by simply clicking on the day for a particular attendee.  I cant find a way to create the event programmatically without showing the dialog.  Unfortunately the "add event" method simply shows the dialog. 

I can call the create method in the controller from jquery but then I would have to refresh the page to show the new data.  

4 Answers, 1 is accepted

Sort by
0
Accepted
Nencho
Telerik team
answered on 15 Jun 2017, 09:53 AM
Hello Reafidy,

You can use tthe dataSource object of the Scheduler and add the new event directly in the collection. Please refer to the following dojo example and documentation article on the add method of the DataSource:

http://dojo.telerik.com/@nenchef/eSere/4


http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#methods-add


Hope this would help.

Regards,
Nencho
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Reafidy
Top achievements
Rank 1
answered on 15 Jun 2017, 08:19 PM
Thanks Nencho. 
0
Varinder
Top achievements
Rank 1
answered on 14 Apr 2020, 02:54 PM

Hi guys,

What I have done is I have added a Context Menu with option Create Event (gets visible after mouse right click on scheduler) .

Now when User clicks on Create event then opening Kendo Window. In this I have two text boxes for Date and Time. 

Here what I want is I need Date and Time from Scheduler where user has clicks right of mouse.

For Example

If user right clicks on any cell of 15th date of scheduler at 10 am then text boxes should get filled with 15-04-2020 and 10:00 am respectively

Similarly, If user right clicks on any cell of 18th date of scheduler at 01 pm then text boxes should get filled with 18-04-2020 and 01:00 pm respectively and so on.

Here is Code Snippet

Also I have attached screen shots.

 Please help.

0
Nencho
Telerik team
answered on 16 Apr 2020, 08:34 AM

Hello, Varinder,

We have a KB article, covering this scenario exactly. Check the following article, in order to observe how the slot info can be passed to the AddEvent popup:

https://docs.telerik.com/kendo-ui/controls/scheduling/scheduler/how-to/editing/editing-using-contextmenu 

See the select event handler of the Context Menu:

  select: function(e) {
            var target = $(e.target);

            if (target.hasClass("k-event")) {
              var occurrenceByUid = scheduler.occurrenceByUid(target.data("uid"));

              scheduler.editEvent(occurrenceByUid);
            } else {
              var slot = scheduler.slotByElement(target);

              scheduler.addEvent({
                start: slot.startDate,
                end: slot.endDate
              });
            }
        },

Hope this would help.

Regards,
Nencho
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
Reafidy
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Reafidy
Top achievements
Rank 1
Varinder
Top achievements
Rank 1
Share this question
or