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

Change event firing off unexpectedly?

2 Answers 114 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Edward
Top achievements
Rank 1
Edward asked on 21 Sep 2015, 10:16 PM

I recently came across a strange issue happening with the kendo Scheduler regarding firing off change events.

I have a custom event handler set so that when a user clicks on an item in the Scheduler it opens a link to a separate details page (in a new tab). The problem is that after doing this, other (unrelated) UI elements in the Scheduler will fire off the exact same event when I click on them.

You can actually see this behavior on the Scheduler Events sample page here: http://demos.telerik.com/kendo-ui/scheduler/events

To replicate:
Click on the Month View button.
Click on (highlighting) the item "HR Lecture", on the 06th. This will fire off a Change event.
Now click on the Month View button again. In between the dataBinding and dataBound events, another Change event will fire off for the same time slot. (Prior to clicking on HR Lecture, this is not the case. You'll only see events for navigation, dataBinding, and dataBound events)

This doesn't seem to happen with all events, HR Lecture just appears to be one that *does* trigger the behavior.

Is this expected? If so, is there any way to prevent this from happening?

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Iliev
Telerik team
answered on 23 Sep 2015, 10:23 AM
Hello Edward,

This behavior is expected as the "HR Lecture" is occurrence of the "HR Lecture" event - please note that recurring events are expanded on each "navigate" event which generates new UIDs for the occurrences. Later when the scheduler tries to restore the selection after the events are rendered the previous UID is no longer available and it fallback to selecting the slot which corresponds to the previous selection. That why in your current scenario it would be better to use custom "click" handler attached to the scheduler element (with filter set to the ".k-event" class) to show the details instead of the scheduler selection.

e.g.:
var scheduler = $("#scheduler").data("kendoScheduler");
scheduler.wrapper.on("mouseup touchend", ".k-event", function(e) {
    var target = $(e.currentTarget);
    var uid = $(e.currentTarget).data("uid");
    var event = scheduler.dataSource.getByUid(uid);
    //you can show the details here instead of editing:
    scheduler.editEvent(event);
});

Regards,
Vladimir Iliev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Edward
Top achievements
Rank 1
answered on 23 Sep 2015, 05:11 PM
That code snippet appears to have accomplished everything I was having trouble with. Thank you!
Tags
Scheduler
Asked by
Edward
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Edward
Top achievements
Rank 1
Share this question
or