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

Unable to load events

1 Answer 47 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 19 May 2017, 02:01 AM

Hi all,

I have been fighting with the scheduler (2017.2.504) for the past few days. I'm simply trying to get two very simple events from my ASP.NET Core WebAPI.

You may find below the configuration of my kendo scheduler:

$('#scheduler').kendoScheduler({
       date: new Date(),
       dataSource: {
           batch: true,
           schema: {
               model: {
                   id: 'bookingId',
                   fields: {
                       bookingId: { type: 'number', from: 'bookingId' },
                       start: { type: 'date', from: 'start' },
                       end: { type: 'date', from: 'end' },
                       title: { from: 'title' },
                       resourceId: { type: 'number', from: 'resourceId' }
                   }
               }
           },
           transport: {
               read: {
                   url: 'http://localhost:57627/api/v1.0/bookings',
                   dataType: 'jsonp'
               },
               parameterMap: function (options, operation) {
                   if (operation === 'read') {
                       // Default values
                       return { start: '2017-05-01', end: '2017-05-31', tectaclocationid: 'locations/801' };
                   } else if (operation !== 'read' && options.models) {
                       return { models: kendo.stringify(options.models) };
                   }
                   return null;
               }
           }
       },
       resources: [{
           field: 'resourceId',
           dataValueField: 'resourceId',
           dataTextField: 'code',
           name: 'Resources'
           dataSource: this.resources
       }]
   });

 

I'm able to confirm that the "bookings" endpoint is correctly called by the scheduler. It always returns the following JSON array:

[{"bookingId":1111,"start":"2017-05-19T06:00:00","end":"2017-05-19T07:00:00","resourceId":1227756,"title":"Test 1"},{"bookingId":2222,"start":"2017-05-19T08:00:00","end":"2017-05-19T09:00:00","resourceId":1227756,"title":"Test 2"}]

 

My resources are correctly loaded (i can see them) but i'm unable to load/see those events. I tried to change the date format, the resourceId, the title without success. I'm probably missing something big :)...

Any idea? 

Thank you so much

1 Answer, 1 is accepted

Sort by
0
Jason
Top achievements
Rank 1
answered on 19 May 2017, 03:01 AM

Found the problem... DataType should be json and not jsonp!

Thx

Seb

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