6 Answers, 1 is accepted
0
Hello Joao,
First, let me clarify your question. Do you mean
"How do I prevent subsequent dragging of the same draggable object after it has been dropped over the expected drop target?"
If this is what you mean, you can use a global Javascript variable as a flag and set it in the OnDrop event. Here is a demo based on this example:
http://demos.kendoui.com/dragdrop/events.html
Best wishes,
Dimo
the Telerik team
First, let me clarify your question. Do you mean
"How do I prevent subsequent dragging of the same draggable object after it has been dropped over the expected drop target?"
If this is what you mean, you can use a global Javascript variable as a flag and set it in the OnDrop event. Here is a demo based on this example:
http://demos.kendoui.com/dragdrop/events.html
var
globalFlag =
false
;
function
draggableOnDragStart(e) {
if
(globalFlag) {
e.preventDefault();
return
false
;
}
}
function
droptargetOnDrop(e) {
globalFlag =
true
;
}
Best wishes,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Dmitriy
Top achievements
Rank 1
answered on 02 Apr 2012, 11:32 AM
$(draggable).off();
0

Eric
Top achievements
Rank 2
answered on 14 Sep 2012, 12:28 PM
I would like more information on this...
The proposed solution will not work for me. I want to destroy the draggable object so that all of the drag events registered with the elements specified by my jQuery selector when creating the draggable object(s) are removed.
I have attempted to call the .destroy() method on the draggable object(s), but to no avail, I am still able to drag the elements post my call to .destroy().
The suggestion offered by Dmitriy will not work for me because there are other event handlers register with the elements in question.
Any assistance/guidance would be appreciated.
The proposed solution will not work for me. I want to destroy the draggable object so that all of the drag events registered with the elements specified by my jQuery selector when creating the draggable object(s) are removed.
I have attempted to call the .destroy() method on the draggable object(s), but to no avail, I am still able to drag the elements post my call to .destroy().
The suggestion offered by Dmitriy will not work for me because there are other event handlers register with the elements in question.
Any assistance/guidance would be appreciated.
0

Nohinn
Top achievements
Rank 1
answered on 14 Sep 2012, 01:53 PM
To delete everything related to drag & drop:
Though, as you can see it may turn out to be a bit more complex if you have assigned too a mousedown handler or a selectstart handler.
Right now that handler would be also deleted, so your app may stop working as it should.
$(
'#draggable'
).removeData(
'kendoDraggable'
);
$(
'#draggable'
).removeData(
'role'
);
$(
'#draggable'
).unbind('
mousedown');
$(
'#draggable'
).unbind('
selectstart');
Though, as you can see it may turn out to be a bit more complex if you have assigned too a mousedown handler or a selectstart handler.
Right now that handler would be also deleted, so your app may stop working as it should.
0

Eric
Top achievements
Rank 2
answered on 14 Sep 2012, 02:33 PM
Thank you for your response Nohinn, i will give your suggestion a try; however, i do have other handlers specified for mouse down (one of the reasons why a call to .off() wouldn't work for me) so it may still be a no go. I suppose when registering the other event handlers I could namespace them and use that to exclude them from being unbound...
Do you have any idea why a call to .destroy() wouldn't do this for me Nohinn, or have I missed the point of the .destroy() method altogether?
Either way it seems odd that this ability is not built into the draggable object... any of the Telerik folks out there have any idea when a means to do this through the draggable API might be available in the control suite?
Do you have any idea why a call to .destroy() wouldn't do this for me Nohinn, or have I missed the point of the .destroy() method altogether?
Either way it seems odd that this ability is not built into the draggable object... any of the Telerik folks out there have any idea when a means to do this through the draggable API might be available in the control suite?
0

Nohinn
Top achievements
Rank 1
answered on 14 Sep 2012, 02:49 PM
It looks like the destroy method for the drag & drop feature would just delete events owned by the kendoDraggable widget, those are:
- drag
- dragcancel
- dragend
- dragstart