Hi,
When I use e.preventDefault(); for editing by a condition based on event data, It returns wrong event data. Please check sample application and follow below steps to reproduce the error.
1. Use google chrome and press Ctrl + Shift + I to get the console
2. Click in Add Event button in the application and it will show events for the period.
3. If you double click on an event and check event data such as start, end date, It always gives wrong data when you use e.preventDefault();
Any idea how to solve this issue?
Thanks,
Lilan
9 Answers, 1 is accepted
Unfortunately the attachment didn't make it through - could you please make sure it's in one of the allowed file extensions (zip, rar, ace, jpg, gif, css, png) and meet the file size requirements (2mb in case of forum post)?
If the project is bigger than the allowed file size you can upload it either in a support ticket (where the limit is 20mb) or in some of the public services available (and provide the link in current thread).
Regards,
Vladimir Iliev
Telerik

Hi Vladimir,
I have not attached any application here other than sample in Dojo. If you click sample application and follow above mentioned steps, you will lead to the error highlighted here.
Thanks,
Lilan
In current case I would suggest to save copy of the event object instead of a reference to the object - please check the example below:
function
schedulerDialyCalendarTimeLine_edit(e) {
e.preventDefault();
var
event = JSON.parse(kendo.stringify(e.event));
console.log(event);
}
Regards,
Vladimir Iliev
Telerik

Hi Vladimir,
I have tried that and again it gives wrong data. Please check sample application using console which above was implemented.
attached screen shot for your reference.
I clicked on 23/6 but event date is 22/6.
Any Idea?
Thanks,
Lilan
The reason for current behavior is that the newly created dataSource have no "timezone" option set - please note that this is not an option of the scheduler but of it's dataSource (the scheduler automatically set it when create new dataSource internally). Please check the updated example below:
var
scheduler = $(
"#schedulerTimeLine"
).data(
"kendoScheduler"
);
var
dataSource =
new
kendo.data.SchedulerDataSource({
data: workplan,
schema: {
timezone:
"Etc/UTC"
,
model: {
id:
"Id"
,
fields: {
start: {
type:
"date"
},
end: {
type:
"date"
},
isAllDay: {
type:
"boolean"
}
}
}
}
});
Regards,
Vladimir Iliev
Telerik

Hello Vladimir ,
Thanks a lot for your solution and it was fixed my issue, but when I applied above configuration event date has been changed. Let say for an example I have added an event to 23/06 but it shows in 22/6 in the scheduler.
you can find different from attached screen shots.
Old Screen - Old scheduler configuration
New Screen- After applied above configuration.
Thanks,
Lilan
Yes, when the timezone is changed the event positioning will also change and now the positioning is the correct one (if you look at the static data you will see the events are rendered using the same start / end times).
Regards,
Vladimir Iliev
Telerik

Hello Vladimir ,
If you look at my sample now, start and end date getting accordingly local datetime since our application used in different regions. At this time if I applied above configuration It will set wrong start and end date.
Sample Event
"Id"
:
"30190bfb-2590-421f-b05b-0ded08fb0b3b"
,
"image"
:
""
,
"priest"
:
"1e66a2e5-d4d7-4481-b32c-abcdfe7be6ce"
,
"start"
:
"Fri Jun 26 2015 00:00:00 GMT+0530 (Sri Lanka Standard Time)"
,
"end"
:
"Fri Jun 26 2015 00:00:00 GMT+0530 (Sri Lanka Standard Time)"
,
"title"
:
"Gudstjeneste"
,
"isAllDay"
:
true
,
"color"
:
"#83744C"
,
"colorItem"
:{
"Id"
:
"f10744a1-cdf2-4715-824d-265d4f1f9483"
,
"name"
:
"Gudstjeneste"
,
"hex"
:
"#83744C"
},
"state"
:
"New"
,
"dayCount"
:1,
"workplanId"
:
null
,
"workplan"
:
"-"
,
"comment"
:
""
As I mention the Scheduler expects to receive the dates and send them to the server only in UTC timezone
- that why if you need to the events to start at midnight you should remove the timezone information from the dates:
"Id"
:
"3d900dc5-e317-4a93-8e64-12452af1c74d"
,
"image"
:
""
,
"priest"
:
"b0949458-57ae-4126-a3f5-ef5b37bb0ee6"
,
//"start":"Mon Jun 22 2015 00:00:00 GMT+0530 (Sri Lanka Standard Time)",
//"end":"Mon Jun 22 2015 00:00:00 GMT+0530 (Sri Lanka Standard Time)",
"start"
:
"2015-06-22T00:00:00.000Z"
,
"end"
:
"2015-06-22T00:00:00.000Z"
,
Regards,
Vladimir Iliev
Telerik