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

Exceptions during drag-and-drop operations in Scheduler

1 Answer 48 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Graham
Top achievements
Rank 1
Graham asked on 27 Jan 2014, 07:46 AM
We use the Scheduler widget like the following: 

<div id="scheduler" style="height:500px"></div>
 
$("#scheduler").kendoScheduler({
    editable: {
        confirmation: false
    },
    resources: ko.observable([
        {
            field: "displayMode",
            dataSource: [
                    { text: "Regular-Other-Future", value: 111, color: "#93D095" },
                    ...
            ]
        }
    ]),
    add: function (e) {
        e.preventDefault();
        // Custom adding implementation
    },
    edit: function (e) {
        e.preventDefault();
        // Custom editing implementation
    },
    remove: function (e) {
        e.preventDefault();
        // Custom removing implementation
    },
    moveStart: function (e) {
        e.preventDefault(); // Prevent drag-and-drop
    },
    move: function (e) {
        e.preventDefault(); // Prevent drag-and-drop
    },
    moveEnd: function (e) {
        e.preventDefault(); // Prevent drag-and-drop
    },
    views: [{ type: "day", showWorkHours: true }, { type: "week", showWorkHours: true, selected: true }, "month", "agenda"],
    timezone: "Etc/UTC",
    date: new Date(),
    dataSource: self.dataSource // self.dataSource is KO observable, which is assigned later with kendo.data.SchedulerDataSource()
});

We need to have custom drag-and-drop handlers, but moveStart/move/moveEnd work unstable, sometimes it's impossible to drop the event (it sticks to mouse cursor) and exceptions are thrown from inside Kendo code after several D&D actions. We tried to block drag-and-drop operations (by calling preventDefault event methods, as you can see in the code above), but this does not help: if aggressively try to drag an event, exception appears again - but expected behavior is nothing should happen since the beginning of drag operation is prevented. 

The question is how to properly implement the moveStart/move/moveEnd handlers to have stable working in both cases (with custom logic and just to block the D&D feature)? 

Thank you very much in advance! 

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 29 Jan 2014, 08:04 AM
Hello Graham,

The moveStart/moveEnd event handlers are only meant to notify the developer of event moving. They cannot be used for custom drag and drop implementations because they are raised by the default one. If you disable event moving by calling e.preventDefault() in moveStart nothing will raise the move and moveEnd events.

If you want to implement custom drag and drop of events you have to disable the built-in ones completely by setting the editable.move and editable.resize options to false:

editable : {
     move: false,
     resize: false
}

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Scheduler
Asked by
Graham
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or