PDA

View Full Version : How to make tree leaf nodes draggable ?



pranavkojha
10 Nov 2014, 7:12 AM
Folks,
I am using the kitchen sink with objects in the left page which needs to be dragged to right page. However, when I make the leaf nodes as dragabble, I see that the drag does not work and the console does not log any message, implying that drag does not seem to come to effect.

When I move the onDrag routines (in red below) to the 'treepanel' object, the the drag operation works fine for the whole tree:



children: [{
52 text: 'Folder 1',
53 expanded: false,
54 children: [{
55 text: 'Leaf 11',
56 draggable: {
57 onDrag: function(e) {
58 // do what you like
59 console.log('we are starting the drag');
60 },
61 onEnd: function(e) {
62 // do what you like
63 console.log('we are ending the drag');
64 }
65 },
66 expandable: false
67 },
68 {
69 text: 'Leaf 12',
70 draggable: {
71 onDrag: function(e) {
72 // do what you like
73 console.log('we are starting the drag');
74 },
75 onEnd: function(e) {
76 // do what you like
77 console.log('we are ending the drag');
78 }
79 },
80 expandable: false
81 }],
82 }, {
83 text: 'Folder 2',
84 expanded: false,
85 children: [{
86 text: 'leaf 21',
87 draggable: {
88 onDrag: function(e) {
89 // do what you like
90 console.log('we are starting the drag');
91 },
92 onEnd: function(e) {
93 // do what you like
94 console.log('we are ending the drag');
95 }
96 },
97 expandable: false
98 },
99 {
100 text: 'leaf 22',
101 draggable: {
102 onDrag: function(e) {
103 // do what you like
104 console.log('we are starting the drag');
105 },
106 onEnd: function(e) {
107 // do what you like
108 console.log('we are ending the drag');
109 }
110 },
111 expandable: false





How can I make the leaf nodes of a tree draggable ??

joel.watson
12 Nov 2014, 10:51 AM
Hi pranavkojha--

Are you talking about this example in Kitchen Sink?

http://dev.sencha.com/ext/5.0.0/examples/kitchensink/#tree-two