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

Events not showing

3 Answers 289 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Niklas
Top achievements
Rank 1
Niklas asked on 28 Dec 2015, 03:01 PM

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
        }
    ]}
}}

3 Answers, 1 is accepted

Sort by
0
Niklas
Top achievements
Rank 1
answered on 28 Dec 2015, 03:03 PM

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}]

0
Vladimir Iliev
Telerik team
answered on 29 Dec 2015, 11:29 AM
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!
 
0
Niklas
Top achievements
Rank 1
answered on 29 Dec 2015, 12:09 PM

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 

Tags
Scheduler
Asked by
Niklas
Top achievements
Rank 1
Answers by
Niklas
Top achievements
Rank 1
Vladimir Iliev
Telerik team
Share this question
or