Tree Grid
The following example shows how to make a tree out of grid control.
| Name | Phone | City | Notified |
|---|---|---|---|
| 016-828-6775 | Bernicemouth | No | |
| 198-318-0678 | West Florencebury | No | |
| 980-623-3121 | Emmaton | Yes | |
| 348-560-9481 | Port Verdaville | Yes | |
| 010-829-8553 | Lake Emmettown | Yes | |
| 399-425-7945 | Klockoland | Yes | |
| 353-318-4792 | Jackelinemouth | Yes | |
| 670-827-4920 | Lake Louvenia | Yes | |
| 528-896-6177 | Chelseyhaven | Yes | |
| 526-777-6481 | Lelahport | No | |
| 176-305-9268 | Dietrichborough | No | |
| 775-933-4928 | Lesleyview | No | |
| 717-760-1911 | Kayleeberg | No | |
| 847-764-2257 | East Amalia | No | |
| 518-322-2883 | Bradytown | Yes | |
| 352-933-3382 | South Delphia | No | |
| 249-675-5864 | East Giovannystad | No | |
| 768-712-0647 | Stokesstad | No | |
| 116-727-4386 | Salliehaven | Yes | |
| 583-694-3588 | Lesliestad | 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 |