Change event firing off unexpectedly?

3 posts, 1 answers
  1. Edward
    Edward avatar
    3 posts
    Member since:
    Sep 2014

    Posted 21 Sep 2015 Link to this post

    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. Answer
    Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2172 posts

    Posted 23 Sep 2015 Link to this post

    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
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Edward
    Edward avatar
    3 posts
    Member since:
    Sep 2014

    Posted 23 Sep 2015 in reply to Vladimir Iliev Link to this post

    That code snippet appears to have accomplished everything I was having trouble with. Thank you!
Back to Top