Package com.smartgwt.client.docs

# Interface SharingNodes

public interface SharingNodes

### Sharing Nodes

For local Trees, that is, Trees that don't use load on demand, Smart GWT supports setting up the Tree structure by setting properties such as "childrenProperty", directly on data nodes. This allows for simpler, faster structures for many common tree uses, but can create confusion if nodes need to be shared across Trees.

using one node in two places in one Tree

To do this, either clone the shared node like so:

           Tree tree = new Tree();
           TreeNode sharedNode = new TreeNode();
           .....
           tree.add(new Record(sharedNode.toMap()));

or place the shared data in a shared subobject instead.

sharing nodes or subtrees across Trees

Individual nodes within differing tree structures can be shared by two Trees only if `Tree.nameProperty`, `Tree.childrenProperty`, and `Tree.openProperty` have different values in each Tree.

As a special case of this, two Trees can maintain different open state across a single read-only structure as long as just "openProperty" has a different value in each Tree.