Custom SchedulerDataSource Error

2 posts, 0 answers
  1. Edi
    Edi avatar
    1 posts
    Member since:
    Mar 2016

    Posted 29 Mar Link to this post

    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:
  2. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 31 Mar Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top