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

The scheduler is not displaying events

1 Answer 526 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
jon
Top achievements
Rank 1
jon asked on 30 Jul 2014, 03:53 AM
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

1 Answer, 1 is accepted

Sort by
0
jon
Top achievements
Rank 1
answered on 30 Jul 2014, 04:13 AM
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.

Tags
Scheduler
Asked by
jon
Top achievements
Rank 1
Answers by
jon
Top achievements
Rank 1
Share this question
or