Skip to content

ext-dnd5 does not set nodes as draggable #680

@jcrosetto

Description

@jcrosetto

Expected and actual behavior

I created a tree using a JS object and enabled DnD5 on it. The nodes that were rendered initially were not draggable (they were missing the draggable attribute). However, any nodes that were hidden under a collapsed node were draggable when the collapsed node was expanded.

I expect them to be draggable.

Steps to reproduce the problem

Check out the fiddler: http://jsfiddle.net/KcxRd/993/

You will notice that the top level nodes that are initially shown are not draggable but the nodes under the collapsed node are.

I believe the issue stems from the block of code within treeInit

// Implement `opts.createNode` event to add the 'draggable' attribute
$.ui.fancytree.overrideMethod(ctx.options, "createNode", function(event, data) {
  // Default processing if any
  this._super.apply(this, arguments);

  data.node.span.draggable = true;
});

being run after the tree is initially created, which happens earlier in treeInit when this._superApply(arguments); is called. The initial tree nodes never get their draggable attribute set to true. A solution may be to move the code above that calls overrideMethod before the call to _superApply.

Environment

  • Browser type and version: Chrome
  • jQuery and jQuery UI versions:
  • Fancytree version: 2.21.0
    enabled/affected extensions: ext-dnd5

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions