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
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,24 @@ slideRegionSize | number | `100` | | Si
61
61
scaffoldBlockPxWidth | number | `44` | | The width of the blocks containing the lines representing the structure of the tree.
62
62
nodeContentRenderer | any | NodeRendererDefault | | Override the default component for rendering nodes (but keep the scaffolding generator) This is an advanced option for complete customization of the appearance. It is best to copy the component in `node-renderer-default.js` to use as a base, and customize as needed.
63
63
64
+
## Data Helper Functions
65
+
66
+
Need a hand turning your flat data into nested tree data?
67
+
Want to perform add/remove operations on the tree data without creating your own recursive function?
68
+
Check out the helper functions exported from [`tree-data-utils.js`](https://github.com/fritz-c/react-sortable-tree/blob/master/src/utils/tree-data-utils.js).
69
+
70
+
Notable among the available functions:
71
+
72
+
-__`getTreeFromFlatData`__: Convert flat data (like that from a database) into nested tree data
73
+
-__`getFlatDataFromTree`__: Convert tree data back to flat data
74
+
-__`addNodeUnderParent`__: Add a node under the parent node at the given path
75
+
-__`removeNodeAtPath`__: Remove the node at the given path
76
+
-__`map`__: Perform a change on every node in the tree
77
+
-__`walk`__: Visit every node in the tree in order
78
+
79
+
Documentation for each method is only available in the code at this time.
80
+
If your hobbies happen to include writing documentation, by all means submit a pull request. It would really help out.
0 commit comments