Letractively / dynatree

Automatically exported from code.google.com/p/dynatree
0 stars 0 forks source link

Add Node flexibility #320

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What new or enhanced feature are you proposing?
I would request that node.addChild(nodeData[, beforeNode]) is enhanced to

node.addNode(nodeData, mode):
Adds a new node.

nodeData may be a node data object as defined in Node options, or an array 
thereof. Also objects and arrays of type DynaTreeNode are allowed.

Possible mode:
child: append the new node as last child of this node. This is the default. To 
be compatble with the D'n'd hitMode, we also accept 'over'.
before: add the new node as sibling before this node.
after: add the new node as sibling after this node.

What goal would this enhancement help you achieve?
This would provide flexibility when adding nodes to place them directly where 
you want them rather then having to move them around after creating them.

Provide a use case?
When I add a new node to a tree I expect it to add as a child, this is fine and 
works will with addChild(nodeData) but would also work well with the proposed 
addNode(nodeData) or addNode(nodeData,'child')

However, when I copy a node I expect it to appear as a sibling below the node I 
am copying. Currently the way to accomplish this is to either:
addChild followed my newNode.move (there is an issue related to doing this see 
issue #319)

or

addChild to the parent of the currently active node using the sibling after the 
active node (if there is one) as the beforeNode parameter.

The proposed method would simplify this to node.addNode(nodeData,'after');

In addition this would align the add node and move node modes which is always 
good for understanding.

Original issue reported on code.google.com by sh...@thecranes.net.nz on 30 May 2012 at 8:37

GoogleCodeExporter commented 8 years ago

Original comment by moo...@wwwendt.de on 4 Jun 2012 at 5:43

GoogleCodeExporter commented 8 years ago

Original comment by moo...@wwwendt.de on 26 Jan 2013 at 4:15

GoogleCodeExporter commented 8 years ago
As of 2014 Dynatree is feature frozen.
Please have a look at Fancytree (sequel of DynaTree 1.x): chances are good that 
the problem was resolved / the requested featuer is already implemented.
Please open a new issue there otherwise:

https://github.com/mar10/fancytree

Original comment by moo...@wwwendt.de on 1 May 2014 at 4:38