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

Possible to handle user cancelling move?

3 Answers 92 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Fabian
Top achievements
Rank 1
Fabian asked on 16 Dec 2016, 01:55 PM

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);

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 20 Dec 2016, 11:32 AM
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.
0
Fabian
Top achievements
Rank 1
answered on 22 Dec 2016, 06:59 PM

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.

0
Accepted
Ivan Danchev
Telerik team
answered on 23 Dec 2016, 02:37 PM
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.
Tags
Scheduler
Asked by
Fabian
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Fabian
Top achievements
Rank 1
Share this question
or