Options
<tree-root [nodes]="nodes" [options]="options"></tree-root>
options
Object of type ITreeOptions
.
See TreeOptions for a complete list, or visit the Guides category for specific use cases.
Example:
import { TREE_ACTIONS, KEYS, IActionMapping, ITreeOptions } from 'angular-tree-component';
class MyComponent {
...
options: ITreeOptions = {
displayField: 'nodeName',
isExpandedField: 'expanded',
idField: 'uuid',
hasChildrenField: 'nodes',
actionMapping: {
mouse: {
dblClick: (tree, node, $event) => {
if (node.hasChildren) TREE_ACTIONS.TOGGLE_EXPANDED(tree, node, $event);
}
},
keys: {
[KEYS.ENTER]: (tree, node, $event) => {
node.expandAll();
}
}
},
nodeHeight: 23,
allowDrag: (node) => {
return true;
},
allowDrop: (node) => {
return true;
},
allowDragoverStyling: true,
levelPadding: 10,
useVirtualScroll: true,
animateExpand: true,
scrollOnActivate: true,
animateSpeed: 30,
animateAcceleration: 1.2,
scrollContainer: document.documentElement // HTML
}
}
Updated less than a minute ago