Possible to handle user cancelling move?

4 posts, 1 answers
  1. Fabian
    Fabian avatar
    5 posts
    Member since:
    Aug 2016

    Posted 16 Dec 2016 Link to this post

    Hi,

     

    I am currently trying to implement a highlighting feature on the scheduler where I set certain classes on elements in the scheduler when an event is being moved by the user.

     

    This works great as long as the user does not cancel the drag operation by hitting the escape button, because then my cleanup code is not getting called. There are moveStart, move, and moveEnd event handlers available, but moveEnd is not being triggered on cancel.

     

    After some investigation I have not found a clean way to do this. All I could come up with was 'hacking' the scheduler and checking e.slot in my moveEnd eventHandler (e.slot undefined => cancel).

     

    Is there a clean way to do this?

     

    kendo.ui.Scheduler.fn._movable = function (movable) {
        return function () {
            var that = this;
     
            movable.call(this);
     
            this._moveDraggable.bind('dragcancel', function () {
                that.trigger('moveEnd');
            });
        };
    }(kendo.ui.Scheduler.fn._movable);
  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    912 posts

    Posted 20 Dec 2016 Link to this post

    Hello Fabian,

    The Scheduler's intended behavior is the moveEnd event not to fire if the event moving is cancelled by the user. Cancelling the event move by pressing the Escape key can be detected through jQuery, as shown in this dojo (week/month view).

    Regards,
    Ivan Danchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Fabian
    Fabian avatar
    5 posts
    Member since:
    Aug 2016

    Posted 22 Dec 2016 in reply to Ivan Danchev Link to this post

    Thanks for your reply.

    I realize that moveEnd is not the intended event for cancel, but since the scheduler does not have an event for moveCancel, that was my workaround, because I do not know how to add custom events to existing kendo widgets.

    Globally listening for key presses is not really a clean solution either, though.

    Maybe you could add a moveCancel event in a future release.

  4. Answer
    Ivan Danchev
    Admin
    Ivan Danchev avatar
    912 posts

    Posted 23 Dec 2016 Link to this post

    Hello Fabian,

    I would ask you to log the addition of a moveCancel event as a feature request in our Feedback Portal. This way other members of the community would be able to vote for it. Highly demanded features often get approved by the team and implemented in future releases.

    Regards,
    Ivan Danchev
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top