The scheduler is not displaying events

2 posts, 0 answers
  1. jon
    jon avatar
    9 posts
    Member since:
    Jun 2010

    Posted 29 Jul 2014 Link to this post

    I think I am going loopy, because this should be working. I've tried every possible way of instantiating a scheduler widget. I can get the widget to return events if I use the MVC wrapper or even a straight copy and paste of the demo's using the jsonp data type.

    But do you think i can get the json data type to work. Here is my code thus far.

    var dsSchedule = new kendo.data.SchedulerDataSource({
    transport: {
             read: {
                url: '/api/Schedule/JobBoard',
                dataType: 'json',
             },
          },
          schema: {
             model: {
                id: 'taskId',
                fields: {
                   taskId: { from: "TaskID", type: "number" },
                   title: { from: "Title", defaultValue: "No title", validation: { required: true } },
                   start: { type: "date", from: "Start" },
                   end: { type: "date", from: "End" },
                   description: { from: "Description" },
                   recurrenceId: { from: "RecurrenceID" },
                   recurrenceRule: { from: "RecurrenceRule" },
                   recurrenceException: { from: "RecurrenceException" },
                   isAllDay: { type: "boolean", from: "IsAllDay" }
                },
             },
          },
       });

    $("#scheduler").kendoScheduler({
          date: new Date(),
          startTime: new Date(),
          height: 600,
          views: ["day", { type: "workWeek", selected: true }, "week", "month", "agenda"],
          dataSource: dsSchedule
       });

    If directly tried setting the dataSource as the widget is instantiated or later as per the following

    var scheduler = $("#scheduler").data("kendoScheduler");
    scheduler.setDataSource(dsSchedule);

    Both methods trigger the SchedulerDataSource to fetch the data

    AggregateResults: null
    Data: [,…]
    0:
    Attendees: null
    Description: null
    End: "2014-08-01T23:59:00Z"
    EndTimezone: null
    IsAllDay: false
    JobId: 64
    RecurrenceException: null
    RecurrenceID: null
    RecurrenceRule: null
    Start: "2014-07-30T00:00:00Z"
    StartTimezone: null
    TaskId: 166
    Timezone: null
    Title: "Full engine rebuild and clean-up"
    Errors: null
    Total: 1

    But yet the schedule does not display the event. I am obviously missing something and there are no demo's of the web scheduler using json. If someone could lead me in the right direction, that would be great.

    Thanks
  2. jon
    jon avatar
    9 posts
    Member since:
    Jun 2010

    Posted 29 Jul 2014 in reply to jon Link to this post

    I may have answered my own post after reading a post very similar to this. 

    http://www.telerik.com/forums/scheduler-datasource-with-webapi-json-not-working#boG_ua6aG2OF1P8AAFTdxQ

    The answer showed the correct json result. According to the demo's, the api method returns a DataSourceResult. this added extra properties to the result. I guess this requires clarification whether the additional "Errors" and "Total" properties are required by the widget.

Back to Top