This question is locked. New answers and comments are not allowed.
I have a treeview whose nodes are draggable to a specific target. But the nodes should not be reorganized, thus they need to be prevented from dragging-and-dropping on the treeview. So I used
function onTreeViewToolBoxNodeDragging(e) {
if ($(e.dropTarget).closest('.t-treeview').length > 0)
e.setStatusClass('t-denied');
}
But the thing is, the root nodes are also draggable to the target specified. How can we prevent this from happening? Thanks.
function onTreeViewToolBoxNodeDragging(e) {
if ($(e.dropTarget).closest('.t-treeview').length > 0)
e.setStatusClass('t-denied');
}
But the thing is, the root nodes are also draggable to the target specified. How can we prevent this from happening? Thanks.
6 Answers, 1 is accepted
0
Hi Jronny,
Theoretically, you can easily prevent the dragging of specific nodes using the NodeDragStart event, like this:
function nodeDragStart(e) {
if ($(e.item.parentNode).is('.t-treeview > .t-group'))
e.preventDefault();
}
We found a bug with the drag&drop API, though, which prevented the above solution to work. The bug is fixed in the attached version of telerik.draganddrop.js.
Sincerely yours,
Alex Gyoshev
the Telerik team
Theoretically, you can easily prevent the dragging of specific nodes using the NodeDragStart event, like this:
function nodeDragStart(e) {
if ($(e.item.parentNode).is('.t-treeview > .t-group'))
e.preventDefault();
}
We found a bug with the drag&drop API, though, which prevented the above solution to work. The bug is fixed in the attached version of telerik.draganddrop.js.
Sincerely yours,
Alex Gyoshev
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items
0

Paul
Top achievements
Rank 1
answered on 29 Sep 2010, 04:08 AM
I am getting an error in the telerik.treeview.js file when I try to call the "e.preventDefault()" method.
The error is that the "this.$dropClue" object is null. It blows up on line 379 of the telerik.treeview.js file here is the section:
Any tips on how to resolve this issue would be greatly appreciated. My goal is to disable dragging and dropping of specific nodes like this post is so I thought this might be the best place to post my question.
Thanks,
Paul
The error is that the "this.$dropClue" object is null. It blows up on line 379 of the telerik.treeview.js file here is the section:
if
(status) {
this
.$dropClue.css(
'visibility'
,
'hidden'
);
return
status;
}
Any tips on how to resolve this issue would be greatly appreciated. My goal is to disable dragging and dropping of specific nodes like this post is so I thought this might be the best place to post my question.
Thanks,
Paul
0
Hello Paul,
Can you please post a more detailed example of what you are doing? I have attached a sample solution that illustrates such a scenario -- child nodes are not allowed to be dragged, only parent ones. What is the difference in your scenario? Please note that the solution uses the updated telerik.draganddrop.js file.
All the best,
Alex Gyoshev
the Telerik team
Can you please post a more detailed example of what you are doing? I have attached a sample solution that illustrates such a scenario -- child nodes are not allowed to be dragged, only parent ones. What is the difference in your scenario? Please note that the solution uses the updated telerik.draganddrop.js file.
All the best,
Alex Gyoshev
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items
0

Paul
Top achievements
Rank 1
answered on 30 Sep 2010, 02:30 PM
I will try that but I have the non-min-fied version of your telerik.draganddrop.js file so I guess I'll have to replace that with the telerik.draganddrop.min.js file and delete the non-min-fied version.
I'll let you know if that doesn't work...
Thanks,
Paul
I'll let you know if that doesn't work...
Thanks,
Paul
0

Paul
Top achievements
Rank 1
answered on 30 Sep 2010, 03:45 PM
This fixed the issue but is there anyway I could get a non-min version of the javascript file?
Or tell me what to change in my telerik.draganddrop.js file?
Thanks,
Paul
Or tell me what to change in my telerik.draganddrop.js file?
Thanks,
Paul
0
Hi Paul,
You can find the original version attached to this post. It is a rather humiliating change...
// OLD:
if (this.onDragStart(e, this.$draggedElement)) {
// drag cancelled
}
// NEW:
if (this.onDragStart(e, this.$draggedElement))
return; // drag cancelled
All the best,
Alex Gyoshev
the Telerik team
You can find the original version attached to this post. It is a rather humiliating change...
// OLD:
if (this.onDragStart(e, this.$draggedElement)) {
// drag cancelled
}
// NEW:
if (this.onDragStart(e, this.$draggedElement))
return; // drag cancelled
All the best,
Alex Gyoshev
the Telerik team
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 Public Issue Tracking
system and vote to affect the priority of the items