TreeField
Picks a node from a hierarchy.
kor/ui/TreeFieldSource
When to use
- Use it for cost centers, categories and locations.
Examples
Cost center
<k:TreeField label="Cost center" leafOnly="true" items="{path: '/nodes', templateShareable: false}"><k:TreeItem key="{id}" parentKey="{up}" text="{text}"/></k:TreeField>
API
Properties
| Name | Type | Default | Description |
|---|
selectedKey | string | | Selected key |
label | string | | Label |
placeholder | string | | Placeholder |
help | string | | Help text |
error | string | | Error text |
leafOnly | boolean | false | Whether only leaves can be chosen |
showPath | boolean | true | Whether the field shows the parent branches |
required | boolean | false | Whether a value is required |
enabled | boolean | true | Whether the control is enabled |
Aggregations
| Name | Type | Description |
|---|
items | TreeItem[] | A flat list. The tree is built from parentKey |
Events
| Name | Type | Description |
|---|
change | key: string | The selection changed |
TreeItem
A tree option.
Properties
| Name | Type | Default | Description |
|---|
key | string | | Key |
parentKey | string | | Key of the parent |
text | string | | Text |
Related
SelectFieldLookupField