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

Configuration Issue? DragAndDrop TreeView item to a ListView

4 Answers 113 Views
Drag and Drop
This is a migrated thread and some comments may be shown as answers.
Nicole
Top achievements
Rank 1
Nicole asked on 07 May 2013, 03:52 PM
Hey,
I'm hoping to find some help on this issue. I have a requirement to enable drag and drop from a kendo ui treeview to a templated listview.
I've tried the following:
  1. Enabling dragAndDrop on the treeview and configuring the listview as a kendoDropTarget......
  2. Disabling dragAndDrop on the treeview and instead configuring that control as kendoDraggable   to  the listview configured as a kendoDropTarget

I'm not having much luck with it. Please take a look at my fiddle. Any suggestions would be greatly appreciated http://jsfiddle.net/JQBZN/1/


4 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 09 May 2013, 01:22 PM
Hi Nicole,

The example is a bit confusing. I cannot see a ListView component on the page, it seems that there is only a TreeView widget. For your convenience I attached a screenshot.
Are you sure that this is the correct fiddle link?

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Nicole
Top achievements
Rank 1
answered on 10 May 2013, 04:49 PM
Sorry it was the wrong version

http://jsfiddle.net/OhenewaDotNet/JQBZN/

I keep getting close but can't seem to get the exact configuration I need.  I'm actually able to drag the treeview items into my listview in my project (not sure why it's not working in js fiddle) but, using the dragAndDrop property in the treeview, I'm unable to set the group property which would allow be to specify my listview as part of the drag drop group (I hope I'm communicating clearly). So when my drop position is over my list view,  the icon still indicates that I can't drop here (even though I can).

0
Alexander Valchev
Telerik team
answered on 13 May 2013, 11:58 AM
Hello Nicole,

Thank you for providing an updated sample.
There was a problem which occurs while adding an item to the ListView's DataSource - in order to avoid it, please pass an object as argument of the add method.
drop: function (e) {
    listDataSource.add({ text: e.draggable.hint.text() });          
}

In order to change the status of the draggable element from denied to add, you can use the drag event handler.
$("#treeview").data("kendoTreeView").bind("drag", function(e) {
    var target = $(e.dropTarget);
    if(target.closest(".k-widget.k-listview").length) {
        e.setStatusClass("k-add");  
    }
});

In addition you should prevent the default drop action:
$("#treeview").data("kendoTreeView").bind("drop", function(e) {
    e.preventDefault();
});

For your convenience I updated the sample: http://jsfiddle.net/JQBZN/60/

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Nicole
Top achievements
Rank 1
answered on 13 May 2013, 02:41 PM
That works for me.....

Thank you
Tags
Drag and Drop
Asked by
Nicole
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Nicole
Top achievements
Rank 1
Share this question
or