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

Kendo Scheduler resets the dates when calling create()

1 Answer 28 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 22 Nov 2013, 10:36 AM
I'm trying to add a new item to the kendo scheduler.
My database columnNames for the start and end are "TimeStart" and "TimeEnd"
These columns have datetime formats.

In the scheduler I use the following lines to read the items from the database.
start: { type: "date", from: "TimeStart" },
end: { type: "date", from: "TimeEnd" },

When I create a new item, I set the TimeStart and TimeEnd to the chosen values.
But, because it's a custom insert form, I use:
$("#Scheduler").data().kendoScheduler.dataSource.add(newItem);

Before adding the item to this function, the dates are properly added to the object.
When I do another console.log() in the create function, the dates are suddenly changed to the current date/time.
My create function is just like this:
create: function (e) {    console.log(e);    }
Why does the dataSource.add() function reset all my dates?

note: I've tested this with another field in my database "CreatedDate", which has no "from" attribute in the fields configuration.
 It turns out that this object doesnt change, when I set it, but when I leave it empty, Kendo will fill it also with the current Date/Time

Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 25 Nov 2013, 08:38 AM
Hello Jason,

In order to set the start or end date of the event you should use the start and end fields not the ones from the original record. The SchedulerEvent is not aware of those "custom" fields. The mapping which is defined in the schema, is used only to populate the fields from the server response and to remap their values to appropriate field when changes are send back to the server. When using the existing SchedulerEvent instances or creating new ones you should use the SchedulerEvent fields.

Regards,
Rosen
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
Jason
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or