Home > sculp-js > formatTree
formatTree() function
Converts a flat array into a tree structure.
Signature:
typescript
export declare function formatTree(list: any[], options?: IFieldOptions): any[];Parameters
Parameter | Type | Description |
|---|---|---|
list | any[] | Flat list of items |
options | (Optional) Customizes id field name, child element field name, parent element field name. Default: { keyField: 'key', childField: 'children', pidField: 'pid' } |
Returns:
any[]
{any[]} Tree structure array