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

Custom SchedulerDataSource Error

1 Answer 39 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Edi
Top achievements
Rank 1
Edi asked on 29 Mar 2016, 03:45 PM

HI, I'm beginner for Telerik Platform with hybrid app. Sorry for this dummy question. I'm trying to load a scheduler with a web service which returns the following:

 

{"JSONDataResult":[{"Description":"Full Name","End":"\/Date(1458450000000-0500)\/","EndTimezone":null,"IsAllDay":true,"OwnerID":"1","RecurrenceException":null,"RecurrenceID":null,"RecurrenceRule":null,"Start":"\/Date(1458450000000-0500)\/","StartTimezone":null,"TaskID":"1","Title":"Full Name"},{"Description":"Full Name","End":"\/Date(1458450000000-0500)\/","EndTimezone":null,"IsAllDay":true,"OwnerID":"2","RecurrenceException":null,"RecurrenceID":null,"RecurrenceRule":null,"Start":"\/Date(1458450000000-0500)\/","StartTimezone":null,"TaskID":"2","Title":"Full Name"}]}

 

View model is the following, but it no works. What's wrong?.  Thanks so much for your help.

 

var viewModel = kendo.observable({
        isVisible: true,
        tasks: new kendo.data.SchedulerDataSource({
            batch: true,
            transport: {
                read: {
                    url: "http://xxx/RestServiceImpl.svc/json",
                    dataType: "json"
                },
                parameterMap: function(options, operation) {
                    if (operation !== "read" && options.models) {
                        return {models: kendo.stringify(options.models)};
                    }
                }
            },          
            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" },
                        startTimezone: { from: "StartTimezone" },
                        endTimezone: { from: "EndTimezone" },
                        description: { from: "Description" },
                        recurrenceId: { from: "RecurrenceID" },
                        recurrenceRule: { from: "RecurrenceRule" },
                        recurrenceException: { from: "RecurrenceException" },
                        isAllDay: { type: "boolean", from: "IsAllDay" }
                    }
                }
            }
        })
    });

 
Sorry for my writing . I'm trying to load a scheduler with a web service which returns the following:
Sorry for my writing . I'm trying to load a scheduler with a web service which returns the following:
Sorry for my writing . I'm trying to load a scheduler with a web service which returns the following:
Sorry for my writing . I'm trying to load a scheduler with a web service which returns the following:
Sorry for my writing . I'm trying to load a scheduler with a web service which returns the following:
Sorry for my writing . I'm trying to load a scheduler with a web service which returns the following:
Sorry for my writing . I'm trying to load a scheduler with a web service which returns the following:
Sorry for my writing . I'm trying to load a scheduler with a web service which returns the following:

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 31 Mar 2016, 07:32 AM
Hi Edi,

From the provided information it seems that the actual data is nested inside the "JSONDataResult" property of the server response - in this case you can set the dataSource "schema.data" to this field in order to look for the data inside it. Please check the example below:

schema: {
     data: "JSONDataResult",

Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Scheduler
Asked by
Edi
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or