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

3 posts, 0 answers
  1. Tom
    Tom avatar
    18 posts
    Member since:
    Apr 2016

    Posted 11 Sep Link to this post

    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;}
  2. Tom
    Tom avatar
    18 posts
    Member since:
    Apr 2016

    Posted 11 Sep in reply to Tom Link to this post

    "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.

  3. Dimitar
    Admin
    Dimitar avatar
    225 posts

    Posted 13 Sep Link to this post

    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.
Back to Top