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

How do I trigger an Update on a newly added event (with ID)?

2 Answers 709 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Tom
Top achievements
Rank 1
Iron
Tom asked on 11 Sep 2017, 09:18 AM

When I add a new event programmatically:

var scheduler = $("#Scheduler").data("kendoScheduler");
scheduler.dataSource.add(newEvent);

In cases where I do not assign an ID to a new event, the Create method is called instantly upon adding the new event, which is great; no problems there.

When I do assign an ID, the Update event is not fired, which is a bit unexpected. If the new event is moved or resized then the appropriate event is fired, but I would like to immediately call the Update function with the newly added event.

I have tried:

scheduler.dataSource.sync()

...but this does not work; the Update method is not called.

If I dig in to the data itself, pick out the relevant event, and call the update function, for example:

scheduler.data()[1].update()

Still no luck, no update method is called. I'm stumped.

How do I trigger an Update for a newly added event?

#MagiCSS-bookmarklet,html>body #MagiCSS-bookmarklet{display: block;} #MagiCSS-bookmarklet .cancelDragHandle{cursor: default;}
Deactivated the code

2 Answers, 1 is accepted

Sort by
0
Tom
Top achievements
Rank 1
Iron
answered on 11 Sep 2017, 12:08 PM

"Create method is called instantly upon adding the new event"

Er rather, this should read "Create method is called with the dataSource.sync()". Still great, still easy to use to keep the scheduler and the datasource in sync. Problem remains with the Update, however.

0
Dimitar
Telerik team
answered on 13 Sep 2017, 07:37 AM
Hello Tom,

When adding a new item to the dataSource of the Kendo UI Scheduler and then call the sync() method, the create method is being triggered, which sends the data on the server and creates the event. If the new event is not yet created on the server, no update event can be triggered. After the item is created, you will be able to invoke the update method (with datasource.sync()) by modifying any of the event properties.

You can also checkout the Kendo UI CRUD Service that is used for the official Scheduler demos. There you will notice that the create method disregards the passed ID and always inserts a new item with the auto-increment ID.

Regards,
Dimitar
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.
Tags
Scheduler
Asked by
Tom
Top achievements
Rank 1
Iron
Answers by
Tom
Top achievements
Rank 1
Iron
Dimitar
Telerik team
Share this question
or