You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+22-2Lines changed: 22 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,7 @@
32
32
-[isCollapsed - check whether a node is collapsed](#iscollapsed---check-whether-a-node-is-collapsed)
33
33
-[expand - expands a node](#expand---expands-a-node)
34
34
-[isExpanded - checks whether a node is expanded](#isexpanded---checks-whether-a-node-is-expanded)
35
+
-[toTreeModel - converts a tree to a TreeModel instance](#totreemodel---converts-a-tree-to-a-treemodel-instance)
35
36
-[rename - renames a node (changes its value underneath)](#rename---renames-a-node-changes-its-value-underneath)
36
37
-[startRenaming - changes the node template so that text input appears and lets a user type a new name](#startrenaming---changes-the-node-template-so-that-text-input-appears-and-lets-a-user-type-a-new-name)
37
38
-[remove - removes a node from the tree](#remove---removes-a-node-from-the-tree)
@@ -334,6 +335,12 @@ Here is an example of its usage:
@@ -357,6 +364,7 @@ Here is an example of its usage:
357
364
*`node` - String - It specifies a html template which will be included to the left of the node's value.
358
365
*`leaf` - String - It specifies a html template which will be included to the left of the leaf's value.
359
366
*`leftMenu` - String - It specifies a html template to the right of the node's value. This template becomes clickable and shows a menu on node's click.
367
+
*`menuItems` - here you can specify your custom menu items. You should feed an array of NodeMenuItem instances to this setting. Once done - setup a subscription to `MenuItemSelectedEvent`s by listening to `(menuItemSelected)="onMenuItemSelected($event)"` on the tree.
360
368
361
369
All options that are defined on a `parent` are automatically applied to children. If you want you can override them by `settings` of the child node.
362
370
@@ -450,7 +458,7 @@ You can subscribe to `NodeCreatedEvent` by attaching listener to `(nodeCreated)`
450
458
`NodeCreatedEvent` has a `node` property of type `Tree`, which contains a created node and a `controller` property, which will give you access to node's controller.
@@ -531,7 +539,11 @@ Relevant for loading children via ngrx (or any redux-inspired library).
531
539
```
532
540
533
541
## :gun: Controller
534
-
First of all you should know how to get a controller of a particular node. You can get a controller of a node only if you set an id property of a node. For example, your tree structure should look like:
542
+
First of all you should know how to get a controller of a particular node. You can get a controller of a node only if you set an id property of a node.
543
+
544
+
> TIP: Ids for nodes created via the context menu or using a TreeController instance get populated automatically unless nodes had ids before there were added to the tree
545
+
546
+
For example, your tree structure should look like:
535
547
536
548
```typescript
537
549
publictree: TreeModel= {
@@ -655,6 +667,14 @@ This method expands the node in case it can be expanded. On successful expanding
655
667
oopNodeController.isExpanded();
656
668
```
657
669
670
+
#### toTreeModel - converts a tree to a TreeModel instance
671
+
672
+
Actually controller makes and returns a clone of tree's underlying model
673
+
674
+
```typescript
675
+
oopNodeController.toTreeModel();
676
+
```
677
+
658
678
This method returns true if the node is expanded and false otherwise.
659
679
660
680
#### rename - renames a node (changes its value underneath)
0 commit comments