Fancytree拖放问题

时间:2019-01-04 08:20:23

标签: javascript drag-and-drop fancytree

我使用Fancytree效果总体良好。但是,我发现DND有问题。如果将preventNonNodes设置为true,则永远不会调用我的dragEnter函数例程。有一行代码显示为“ if(dndOpts.preventNonNodes &&!nodeData)”。实际上,noneData始终是未定义的。如果preventNonNodes为true,那么从不调用dragEnter()例程?我在这里做错了。这个问题应该发布在GitHub上吗?

下面是一些有效的代码。拖动dragEnter例程。

    /* Provide some options and routines for drag-and-drop */
    dnd5: {
      /* Expand nodes after n milliseconds of hovering - default */
      autoExpandMS: 1500,      
      /* Absolute position offset for .fancytree-drop-marker - default */
      /* Relative to ..fancytree-title (icon/img near a node accepting drop) */
      dropMarkerOffsetX: -24,  
      /* Additional offset for drop-marker with hitMode = "before"/"after" - default*/
      dropMarkerInsertOffsetX: -16, 
      /* true: Drag multiple (i.e. selected) nodes - default is false*/
      multiSource: false,                
      /* Prevent dropping nodes from different Fancytrees - default is false */
      preventForeignNodes: true,   
      /* Prevent dropping items other than Fancytree nodes - default is false */
      preventNonNodes: false,       
      /* Prevent dropping nodes on own descendants - default */
      preventRecursiveMoves: true,  
      /* Prevent dropping nodes 'before self', etc. - default */
      preventVoidMoves: true,     
      /* Enable auto-scrolling while dragging - default */
      scroll: true,        
      /* Active top/bottom margin in pixel - default */
      scrollSensitivity: 20,        
      /* Pixels per event - default */
      scrollSpeed: 5,               
      /* Events (drag support) */
      dragStart: function (node, data) {
        console.log('dragStart');
        return true;
      },
      dragDrag: function (node, data) {
        console.log('dragDrag');
      }, 
      dragEnd: function (node, data) {
        console.log('dragEnd');
      },         
      /* Events (drop support) */
      dragEnter: function (node, data) {
        console.log('dragEnter');
        return true;
      },      
      dragOver: function (node, data) {
        console.log('dragOver');
      },     
      dragExpand: function (node, data) {
        console.log('dragExpand');
        return true;
      },      
      dragDrop: function (node, data) {
        console.log('dragDrop');
      },
      dragLeave: function (node, data) {
        console.log('dragLeave');
      }
    },

1 个答案:

答案 0 :(得分:0)

此问题是由于版本2.30.2的fixed here错误导致的。