Tree Grid
The following example shows how to make a tree out of grid control.
| Name | Phone | City | Notified |
|---|---|---|---|
| 495-494-3810 | West Johnathan | Yes | |
| 245-843-7186 | Edgardoside | No | |
| 357-913-3839 | Nadershire | No | |
| 124-694-7355 | Lukasview | No | |
| 383-508-4095 | Uptonstad | Yes | |
| 775-536-5192 | Quigleytown | No | |
| 811-458-2932 | Danmouth | Yes | |
| 493-005-0647 | West Gersonberg | No | |
| 137-853-5598 | East Lamontborough | Yes | |
| 313-055-7296 | Josianneton | No | |
| 034-086-3857 | Lake Jadyn | Yes | |
| 085-202-1349 | South Devenview | No | |
| 124-107-0776 | West Bo | Yes | |
| 331-008-1901 | East Lukasmouth | Yes | |
| 527-798-3428 | Lunafurt | No | |
| 861-124-7224 | Beulahton | Yes | |
| 787-156-5423 | East Paige | Yes | |
| 132-009-3160 | New Casandrachester | No | |
| 233-670-6141 | Letitiamouth | Yes | |
| 423-897-0267 | Reingermouth | 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 |