We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Mulitple drag & drop issue

Thread ID:

Created:

Updated:

Platform:

Replies:

130643 May 23,2017 10:33 AM UTC May 24,2017 11:59 AM UTC ASP.NET MVC 1
loading
Tags: TreeView
Kuntal Patel
Asked On May 23, 2017 10:33 AM UTC

Hello,

Below is my code for tree view.

  @(Html.EJ().TreeView("tree").AllowDragAndDrop(true).AllowMultiSelection(true)
            .TreeViewFields(field =>
                field.Datasource((List<TM>)ViewBag.Tasks)
                .Id("ID")
                .ParentId("ParentID")
                .Text("TaskName")
            ).Template("#treeTemplate").ClientSideEvents(e=>e.NodeDragStop("NodeDropped"))
    )


<script>
    function NodeDropped(args) {
        debugger
        console.log(args.draggedElementData)
        console.log(args.targetElementData)
       

    }
</script>

The problem is,in case of multiple elements get dragged i'm getting only the first dragged element. If i drag 3 elements together,how to access all of them while drag and drop? I don't mind if the different event should be used.

Piramanayagam Ramakrishnan [Syncfusion]
Replied On May 24, 2017 11:59 AM UTC

Hi Kuntal, 
 
Thanks for contacting Syncfusion support. 
 
We didn’t provide the all dragged node details in event arguments due to performance leak. But we can get all dragged nodes by using public method “getSelectedNodes” while drag and drop. This method returns all selected nodes element. Please refer to below code sample, 
 
[script] 
function NodeDropped(args) { 
    //check multiple nodes are dragged or not 
    if (this.model.allowMultiSelection && args.draggedElement.find("> div > a").hasClass("e-active") && this.model.selectedNodes.length > 1) { 
        //get all draggedNodes element 
        var selNodes = this.getSelectedNodes(); 
        for (var i = 0; i < selNodes.length; i++) { 
            //get each dragged node element 
            console.log($(selNodes[i])); 
        } 
    } 
    else { 
        console.log(args.draggedElement); 
    } 
} 
 
For your reference, we have prepared a simple sample based on this, and it can be downloaded from the following location: Sample 
 
Please let us know whether the provided sample was helpful in achieving your requirement. If not, send us more information to proceed further.   
 
Regards, 
Piramanayagam R

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;