Scheduler doesn't load JSON datas

2 posts, 0 answers
  1. Rajan
    Rajan avatar
    4 posts
    Member since:
    Mar 2015

    Posted 23 Dec 2016 Link to this post

    Hi,

    I am newly used kendo ui scheduler control. i want to load data's based on from and to date (Kendo ui datepicker used). the datasource read function fetch the datas, but it doesn't show anything. this is my below code. please anyone suggest me, is any mistake in my scheduler coding or JSON data.

    Thanks in advance.

    scheduler coding:

    Loadscheduler: function () {
           var formatted_date = new Date($("#txtfrmdate").data("kendoDatePicker").value());
           var yyyy = formatted_date.getFullYear();
           var dd = formatted_date.getDate();
           var mm = formatted_date.getMonth() + 1;       
     
           var param = '&fromdate=' + $('#txtfrmdate').val() +
                       '&todate=' + $('#txttodate').val();
     
           $("#calendarviewgrid").html("");
           $("#calendarviewgrid").kendoScheduler({
               date: new Date(formatted_date),
               startTime: new Date(yyyy, mm, dd, 6, 0, 0),
               endTime: new Date(yyyy, mm, dd, 22, 0, 0),
               height: 600,
               views: [{ type: "week", selected: true}],
               editable: false,
               dataSource: {
                   batch: true,
                   transport: {
                       read: {
                           url: "Controller/Enquiry/Enquiry.ashx?cmd=calendarview" + param,
                           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" }
                       }
                   }
               }
           });
       }

    My JSON Data:

    [{"TaskId":1,"Title":"WS - HIPE","Start":"\/Date(1483432200000)\/","End":"\/Date(1483435800000)\/"},{"TaskId":2,"Title":"WS - HIPM","Start":"\/Date(1483435800000)\/","End":"\/Date(1483438500000)\/"},{"TaskId":3,"Title":"WS - HIPC","Start":"\/Date(1483439400000)\/","End":"\/Date(1483441200000)\/"},{"TaskId":4,"Title":"WS - HIPM","Start":"\/Date(1483525800000)\/","End":"\/Date(1483529400000)\/"},{"TaskId":5,"Title":"WS - HIPB","Start":"\/Date(1483529400000)\/","End":"\/Date(1483533000000)\/"},{"TaskId":6,"Title":"WS - HIPE","Start":"\/Date(1483696800000)\/","End":"\/Date(1483700400000)\/"},{"TaskId":7,"Title":"WS - HIPM","Start":"\/Date(1483700400000)\/","End":"\/Date(1483703100000)\/"},{"TaskId":8,"Title":"WS - HIPC","Start":"\/Date(1483704000000)\/","End":"\/Date(1483705800000)\/"}]
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1434 posts

    Posted 26 Dec 2016 Link to this post

    Hello Rajan,

    As mentioned in the support ticket regarding the same issue - this happens because the schema is declared outside of the DataSource, so the start and end date strings are not being parsed.

    Regards,
    Alexander Popov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top