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

Drop event dataItem issue - Tree View

1 Answer 145 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Catalin
Top achievements
Rank 1
Catalin asked on 14 Mar 2016, 11:29 AM

Hello, 

 

I`m having a bit of a problem, I have set up a tree view, everything get's loaded properly. The problem that I am facing is that I cannot for some reason access the source and target data items.

The thing that baffles me is that on the select using e.node event I`m getting the proper data: 

{_events: Object, _handlers: Object, _id: "56e687375f800af840a30683", name: "5", tenantId: "56bdcc6c3a0328620c306d72"…}
_childrenOptions: Object
_events: Object
_handlers: Object
_id: "56e687375f800af840a30683"
_loaded: false
address: me.extend.init
assets: me.extend.init[0]
attrs: me.extend.init[0]
childNodes: me.extend.init[0]
dirty: false
hasChildren: false
id: "56e687375f800af840a30683"
index: 1
name: "5"
parent: ()
parentId: "56e687305f800af840a30681"
path: "1/3/5"
tenantId: "56bdcc6c3a0328620c306d72"
uid: "a8b4032a-db93-452c-a622-3fe93a5b4ab4"

But in the drop using the same thing on e.destinationNode or e.targetNode I get something like this 

o {_events: Object, _handlers: Object, _loaded: true, text: "↵ ↵ 5↵", uid: "9030564d-9f42-491c-8824-21983e3cbe04"…}
_childrenOptions: Object
_events: Object
_handlers: Object
_loaded: true
children: J.extend.init
dirty: false
expanded: false
hasChildren: false
id: ""
items: me.extend.init[0]
parent: ()
text: "↵ ↵ 5↵"
uid: "9030564d-9f42-491c-8824-21983e3cbe04"
__proto__: i

In both cases I`m using: 

$("#treeview2").data("kendoTreeView").dataItem(e.destinationNode)

 

Treeview: 

$("#treeview2").kendoTreeView({
     dataSource: schema,
     dataTextField: "name",
     dragAndDrop: true,
     drag: drag,
     drop: drop,
     select: select,
     dataBound: onDataBound,
     template :kendo.template($("#treeview-template").html())
   });

Schema:

var schema = new kendo.data.HierarchicalDataSource({
    transport: {
      read: function (options) {
        // ajax request
      }
    },
    schema: {
      model: {
        id: "_id",
        hasChildren: "hasLocations",
        children: "chd"
      }
    }
  });

 

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 17 Mar 2016, 10:08 AM

Hello Catalin,

Can you please provide a Dojo snippet that reproduces the problem, along with some context? What are the drop / dragend handlers?

Regards,
Alex Gyoshev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeView
Asked by
Catalin
Top achievements
Rank 1
Answers by
Alex Gyoshev
Telerik team
Share this question
or