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. Image for the cookie policy date

Drag and Drop first element in the tree view


I have implemented drag and drop functionality. It is working fine for all the items except the first one. I do not get the updated model when I drag the first element and I get below error -

ERROR TypeError: Cannot read property '0' of undefined
    at TreeViewComponent.push../node_modules/@syncfusion/ej2-navigations/src/treeview/treeview.js.TreeView.moveData (treeview.js:3076)
    at TreeViewComponent.TreeView.dropAsChildNode (treeview.js:3043)
    at TreeViewComponent.TreeView.appendNode (treeview.js:3007)
    at TreeViewComponent.TreeView.dropAction (treeview.js:2984)
    at Droppable.drop (treeview.js:2866)
    at Observer.notify (observer.js:99)
    at Droppable.Base.trigger (base.js:152)
    at Droppable.intDrop (droppable.js:95)
    at Draggable.intDragStop (draggable.js:467)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:421)

Can you please help me with this issue?


1 Reply

SA Shameer Ali Baig Sulaiman Ali Baig Syncfusion Team February 7, 2020 07:59 PM UTC

Hi Samir, 
Greetings from Syncfusion support. 
We have looked into your reported problem in TreeView and we tried to replicate the reported issue at our end. But, the reported issue was not reproduced, as the Drag and Drop functionality in TreeView component is working properly and it does not thrown the reported script error. 
Please, the sample which we have prepared for your reference. 
Please, check the sample, let us know whether this sample resolves your reported problem.  
If the reported issue still persists, then please share us more details regarding your reported problem. 
·        Issue reproducing scenario and your exact requirement details. 
·        Share us the code sample in which you face this problem. 
·        Screenshot or video sample of the reported problem. 
·        If possible, could you please replicate the reported issue in our attached sample and share it to us? 
This information would help us to understand your exact problem and provide you the prompt solution. 
Shameer Ali Baig S. 

Live Chat Icon For mobile
Up arrow icon