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

[Solved] Trying to understand the Drag&Drop Sample

5 Answers 119 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Frank Michael
Top achievements
Rank 1
Frank Michael asked on 04 Jun 2010, 12:30 PM
I am trying to understand the Drag&Drop Sample.
I debugged the Java Script.

1) How does the TreeView know, that dropping is only allowed in the Bravo and Charly Team Panes?
2) Seemingly there is no custom code for dropping within the tree. So I assume that the tree does handle it. I assume that I would use the client API events to post it.
3) Is it recommended to post at every drop or is it better to rearrange and then post at the end (e.g. button)
4) If I post at the end (button) how would I read the resulting tree? I think there should be client API methods for this?

5 Answers, 1 is accepted

Sort by
0
Frank Michael
Top achievements
Rank 1
answered on 04 Jun 2010, 01:03 PM
1) I found the answer.
2) Still working on it. See below
3) I'll ty to post each time of a drop.
4) Not relevant.

        function onNodeDrop(e) { 
 
            var id = e.item.value; 
            var newSuper = e.destinationItem.value; 
            var target = "/Home/AjaxTreeDrop?id=" + id + "&newSuper=" + newSuper; 
 

According to the documenation e.destinationItem should contain the item of the tree to which the item is dropped. But when I debug, destinationItem is not defined. Why?

I'll soon post the sample project.
0
Frank Michael
Top achievements
Rank 1
answered on 04 Jun 2010, 01:07 PM
This is the sample project

http://cid-a7d5afee7d992a7a.skydrive.live.com/self.aspx/Telerik/TreeDragAndDrop.zip
0
Accepted
Alex Gyoshev
Telerik team
answered on 07 Jun 2010, 08:11 AM
Hello Frank Michael,

You should use the onNodeDropped instead of the onNodeDrop event:
  • the onNodeDrop event is triggered immediately when the dragged object is released. This is useful if you want to use the node (i.e. add it to a container) before the TreeView logic kicks in.
  • the onNodeDropped event is triggered when the TreeView has processed the node drop -- which is useful when you want to save the treeview state (in a cookie or through ajax)

Best wishes,
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
Frank Michael
Top achievements
Rank 1
answered on 07 Jun 2010, 12:06 PM
So far so good.
Now I have this problem: e.item.value returns -1
But the html is this:
<li class="t-item"><div class="t-mid"><span class="t-icon t-plus"></span><span class="t-in">Ein neues Workitem</span><input type="hidden" value="28d02001-a93c-4850-9ec8-66b913e43127" name="itemValue" class="t-input"></div></li

I would expect 09375b22-e598-40ea-aa66-50a567d43d92 as the return value. Did I misunderstand the example?
0
Accepted
Atanas Korchev
Telerik team
answered on 07 Jun 2010, 12:11 PM
Hello Frank Michael ,

The value of the node should be retrieved like this:

var value = treeView.getItemValue(e.item);

Regards,
Atanas Korchev
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.
Tags
TreeView
Asked by
Frank Michael
Top achievements
Rank 1
Answers by
Frank Michael
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Atanas Korchev
Telerik team
Share this question
or