Events not showing

4 posts, 0 answers
  1. Niklas
    Niklas avatar
    3 posts
    Member since:
    Dec 2015

    Posted 28 Dec 2015 Link to this post

    Im not seeing any events. I think it might be the format on start and end.

     This is my schedule options:

    $scope.schedulerOptions = {
                date: new Date("2015/12/28"),
                startTime: new Date("2015/12/28 07:00 AM"),
                views: [
                    "day",
                    { type: "workWeek", selected: true },
                    "week",
                    "month",
                ],
                timezone: "Etc/UTC",
                dataSource: {
                    data: $scope.panel.entities,
                    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" }
                            }
                        }
                    },
                },
            };

    And the json string in $scope.panel.entities looks like this:

    {
    "date":"2015-12-27T23:00:00.000Z",
    "startTime":"2015-12-28T06:00:00.000Z",
    "views":["
        day",{
            "type":"workWeek",
            "selected":true},
        "week",
        "month"
    ],
    "timezone":"Etc/UTC",
    "dataSource":{
        "data":[{
            "taskId":1,
            "title":"Skoter",
            "start":"2015-12-29T08:00:00Z",
            "end":"2015-12-29T13:00:00Z",
            "description":"Åka skoter",
            "ownerId":1
        }],
        "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"
                    },
                    "ownerId":{
                        "from":"ownerID",
                        "defaultValue":1
                    }
                }
            },
            "timezone":"Etc/UTC"
        },
        "filter":{
            "logic":"or",
            "filters":[{
                "field":"ownerId",
                "operator":"eq",
                "value":1
            },{
                "field":"ownerId",
                "operator":"eq",
                "value":2
            }
        ]}
    }}

  2. Niklas
    Niklas avatar
    3 posts
    Member since:
    Dec 2015

    Posted 28 Dec 2015 in reply to Niklas Link to this post

    Accidently posted the wrong json string.

    This is how $scope.panel.entities looks like:

    [{"taskId":1,"title":"Skoter","start":"2015-12-29T09:00:00","end":"2015-12-29T14:00:00","description":"Åka skoter","ownerId":1}]

  3. Kendo UI is VS 2017 Ready
  4. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 29 Dec 2015 Link to this post

    Hello Niklas,

    I tried to reproduce the problem locally but to no avail – everything is working as expected on our side with similar configuration. Could you please check the following demo and let us know how it differs from your real setup? This would help us pinpoint the exact reason for this behavior.


    Regards,
    Vladimir Iliev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Niklas
    Niklas avatar
    3 posts
    Member since:
    Dec 2015

    Posted 29 Dec 2015 Link to this post

    I fixed the problem by adding this to transform the dates before sending them to the shedule

    $scope.transformData = function (response) {
                $scope.panel.result = [];
                var event;
                for (var idx = 0, length = response.length; idx < length; idx++) {
                    event = response[idx];
     
                    $scope.panel.result.push(new kendo.data.SchedulerEvent({
                        id: event.taskId,
                        taskId: event.taskId,
                        ownerId: event.ownerId,
                        start: kendo.parseDate(event.start),
                        end: kendo.parseDate(event.end),
                        title: event.title,
                        description: event.description
                    }));
                }
            };

    Also i added a timeout function around the schedulerOptions 

Back to Top
Kendo UI is VS 2017 Ready