Tree Grid
The following example shows how to make a tree out of grid control.
| Name | Phone | City | Notified |
|---|---|---|---|
| 899-565-8733 | Lake German | Yes | |
| 856-631-5298 | Chasityburgh | No | |
| 753-336-4952 | Taramouth | No | |
| 875-074-3747 | Liammouth | Yes | |
| 860-208-8388 | Rosemarymouth | No | |
| 043-812-5709 | Nealbury | Yes | |
| 355-429-5559 | East Kevin | Yes | |
| 368-215-1860 | Kunzeview | No | |
| 241-463-7027 | Huelsburgh | No | |
| 100-079-1256 | West Norval | Yes | |
| 678-700-5447 | South Ralph | No | |
| 594-876-5995 | Rodriguezberg | Yes | |
| 763-207-1056 | Hettingerton | No | |
| 480-767-4851 | West Tom | No | |
| 014-002-8730 | New Sheridanton | Yes | |
| 698-769-0805 | Russellshire | Yes | |
| 026-404-7410 | Lake Olliestad | Yes | |
| 297-928-4730 | East Grant | No | |
| 405-354-2880 | South Riley | No | |
| 267-915-9614 | Serenityfort | No |
| Name | Phone | City | Notified |
|---|
<Grid buffered records-bind='$page.data' mod="tree" style={{width: "100%", height: '500px'}} scrollable={true} dataAdapter={{ type: TreeAdapter, load: (context, {controller}, node) => controller.generateRecords(node) }} selection={{type: KeySelection, bind: "$page.selection"}} columns={[ { header: 'Name', field: 'fullName', sortable: true, items: <cx> <TreeNode expanded-bind="$record.$expanded" leaf-bind="$record.$leaf" level-bind="$record.$level" loading-bind="$record.$loading" text-bind="$record.fullName" icon-bind="$record.icon" /> </cx> }, {header: 'Phone', field: 'phone'}, {header: 'City', field: 'city', sortable: true}, { header: 'Notified', field: 'notified', sortable: true, value: {expr: '{$record.notified} ? "Yes" : "No"'} } ]} />
Searching Tree Grids
Check out this example to find out how to implement search functionality in a Tree Grid.
TreeNode Configuration
| Property | Description | Type |
|---|---|---|
expanded | A value indicating if tree node is expanded or not. | boolean |
icon | An icon to be displayed. If not set, default icons will be used. | string |
leaf | A value indicating if tree node is a leaf node or not. Leaf nodes cannot have any children. | boolean |
level | A value indicating the depth level inside the tree used for indenting. | number |
loading | A value indicating if tree node is currently loading its children. | boolean |
text | Text to be displayed alongside the icon. | string |
autoFocus | Set to | boolean |
baseClass | Base CSS class to be applied to the element. Default is 'treenode'. | string |
class | Additional CSS classes to be applied to the element. If an object is provided, all keys with a "truthy" value will be added to the CSS class list. | string/object |
folderIcon | Icon to be used to represent folders. Default is | string |
hideArrow | A value indicating if arrow should be displayed or not. Can be used to hide arrow for folders with no children. | boolean |
hideIcon | Set to | boolean |
innerHtml | HTML to be injected into the element. | string |
itemIcon | Icon to represent leaf nodes. Default is | string |
items | List of child elements. | array |
layout | Define an inner layout. | string/object |
loadingIcon | Icon to be used while in loading state. Default is | string |
mod | Appearance modifier. For example, | string/array |
openFolderIcon | Icon to be used to represent open folders. Default is | string |
outerLayout | Defines the outer layout which wraps the widget. | widget |
plainText | Set to | boolean |
preserveWhitespace | Keep whitespace in text based children. Default is | boolean |
putInto | Used with outer layouts. Specifies the name of the content placeholder which should render the widget. | string |
style | Style object applied to the wrapper div. Used for setting the dimensions of the element. | string/object |
tag | Name of the HTML element to be rendered. Default is | string |
tooltip | Tooltip configuration. For more info see Tooltips. | string/object |
trimWhitespace | Remove all whitespace in text based children. Default is | boolean |
vdomKey | Key that will be used as the key when rendering the React component. | string |
visible | Visibility of the widget. Defaults to | boolean |