DragDrop.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * @class SimpleTasks.ux.DragDrop
  3. * @extends Ext.grid.plugin.DragDrop
  4. *
  5. * This plugin modifies the behavior of Ext.tree.plugin.TreeViewDragDrop. to allow the DropZone to handle
  6. * multiple types of records (Tasks and Lists)
  7. */
  8. Ext.define('SimpleTasks.ux.DragDrop', {
  9. extend: 'Ext.tree.plugin.TreeViewDragDrop',
  10. alias: 'plugin.tasksdragdrop',
  11. requires: [
  12. 'Ext.view.DragZone',
  13. 'SimpleTasks.ux.DropZone'
  14. ],
  15. /**
  16. * @event taskdrop
  17. * **This event is fired through the GridView. Add listeners to the GridView object**
  18. *
  19. * Fires when a task record is dropped on the group view
  20. * @param {SimpleTasks.model.Task} task The task record
  21. * @param {SimpleTasks.model.Group} group The group that the task was dropped on
  22. */
  23. /**
  24. * @event groupdrop
  25. * **This event is fired through the GridView. Add listeners to the GridView object**
  26. *
  27. * Fires when a group record is dropped on the group view
  28. * @param {SimpleTasks.model.Group} group The group that was dropped
  29. * @param {SimpleTasks.model.Group} overGroup The group that the group was dropped on
  30. * @param {String} position `"before"` or `"after"` depending on whether the mouse is above or below the midline of the node.
  31. */
  32. onViewRender : function(view) {
  33. var me = this;
  34. if (me.enableDrag) {
  35. me.dragZone = Ext.create('Ext.tree.ViewDragZone', {
  36. view: view,
  37. ddGroup: me.dragGroup || me.ddGroup,
  38. dragText: me.dragText,
  39. repairHighlightColor: me.nodeHighlightColor,
  40. repairHighlight: me.nodeHighlightOnRepair
  41. });
  42. }
  43. if (me.enableDrop) {
  44. me.dropZone = Ext.create('SimpleTasks.ux.DropZone', {
  45. view: view,
  46. ddGroup: me.dropGroup || me.ddGroup,
  47. allowContainerDrops: me.allowContainerDrops,
  48. appendOnly: me.appendOnly,
  49. allowParentInserts: me.allowParentInserts,
  50. expandDelay: me.expandDelay,
  51. dropHighlightColor: me.nodeHighlightColor,
  52. dropHighlight: me.nodeHighlightOnDrop
  53. });
  54. }
  55. }
  56. });