Costas Aletrari
Costas Aletrari

Reputation: 387

How do I add an event to a Kendo UI Scheduler?

we have been trying to get the kendo scheduler working with signalr to create a realtime scheduler, are are able to successfully update the kendo console which now works for all clients connected to the scheduler. our trouble now is adding the event manually with javascript. here is our example:

var notificationHub = $.connection.MyBookingHub;

notificationHub.client.Notify = function (MyStart, MyEnd, MyMessage) {
    kendoConsole.log(kendo.toString(new Date(MyStart) + " " + new Date(MyEnd) + " " + MyMessage));

    //this is where we are doing something wrong as we get an error regarding the "set" property
    e.events.set("start", new Date(MyStart));
    e.events.set("end", new Date(MyEnd));
    e.events.set("title", MyMessage);
};

Upvotes: 2

Views: 3623

Answers (1)

Lars Höppner
Lars Höppner

Reputation: 18402

From the code snippet, I can't tell what you expect the e variable to be. It looks like you may be confusing the technical events of the widget with the conceptual event data which is displayed with the scheduler widget.

Here's one way to add an event to an existing scheduler widget (using the DataSource.add method):

var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.dataSource.add( {
  start: new Date("2013/6/6 08:00 AM"),
  end: new Date("2013/6/6 09:00 AM"),
  title: "Interview"
});

You would only use the ObservableObject.set method on existing models.

Upvotes: 2

Related Questions