Skip to content

DnD and Sorting of tree nodes #36

Description

@simoami

Awesome component! It would be great if it supported drag and drop operations to either sort tree nodes or drop into a different pattern. Since everyone has a different use case, a handler canDrop(node: Node, newParent: Node, oldParent: Node) -> Boolean where the default handler returns true all the time. Here's what the new API could look like:

node props:

draggable: {Boolean | Function} - function if behavior is dynamic. E.g. disabled node can't be dragged
dragGroup: {String} - allows for nodes to only interact with their own types

tree props:

dragNodes: {Boolean} - enables drag & drop behavior
sortable: {Boolean} - enables sorting behavior with nodes on the same dragGroup
canDrop(node: Node, newParent: Node, oldParent: Node) -> Boolean
didDrop(node: Node, newParent: Node, oldParent: Node, position: Number) -> void - position is relevant when sortable is on and the node is dropped into a specific position inside a parent node

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions