dragging multiple rows from a listview to another listview

2 posts, 1 answers
  1. BRAD
    BRAD avatar
    27 posts
    Member since:
    May 2012

    Posted 09 Dec 2014 Link to this post

    Hi there.  I'm having trouble dragging multiple rows from a listview into another listview.  Please see this plunker: http://plnkr.co/edit/FdMjVVLVHRcpHTCjhsT6?p=info for a description of what i'm working on.  the listview on the bottom has little circle 'X''s that i should be able to drag into the top listview.  I have 'multiple' select set for the bottom listview, so i would like to ctrl-click on the rows in the bottom list view to drag multiple, but  e.draggable.currentTarget is always just an array of 1, it never shows the other rows.  How do I fix this?  If i have to reachback and look at the listviews currently selected rows, instead of just looking at what is dropped, i'm fine with that, but that doesn't seem to work either.
  2. Answer
    Nikolay Rusev
    Nikolay Rusev avatar
    2277 posts

    Posted 11 Dec 2014 Link to this post

    Hello Brad,

    This is expected as every item is a draggable and only one item can be dragged at a time. You can however expand the logic inside `droptargetOnDrop` method a bit in order to get all selected items from the ListView and drop them.

    Here is how the code might be implemented:
    $scope.droptargetOnDrop = function(e) {
        //var dragid = e.draggable.currentTarget[0].id;
        var widget = e.draggable.currentTarget.closest("[data-role=listview]").data("kendoListView");
        var selectedItems = widget.select();
        var dragid = "";
        if (selectedItems.length) {
          dragid = selectedItems.map(function() { 
            return widget.dataItem(this).EmployeeID; 
          }).toArray().join(" ,"); 
        } else {
          dragid = e.draggable.currentTarget[0].id;

        var dropid = e.dropTarget[0].id;
        alert("dragid=" + dragid + ", dropid=" + dropid)

    Updated example: http://plnkr.co/edit/PiXAy41YDsI3wPCYy7LM?p=preview.

    Nikolay Rusev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top