Tree Grid
The following example shows how to make a tree out of grid control.
| Name | Phone | City | Notified |
|---|---|---|---|
| 542-558-5600 | New Bernadetteton | Yes | |
| 897-658-6317 | Lake Ophelia | No | |
| 111-012-2282 | Effieview | Yes | |
| 323-579-9802 | Port Emily | No | |
| 132-686-8774 | North Shyann | No | |
| 876-607-0973 | South Gayleport | Yes | |
| 743-445-1933 | East Ferne | No | |
| 079-749-2956 | Pagacfort | No | |
| 430-923-8493 | West Conner | No | |
| 023-017-4854 | Lake Paytonfurt | No | |
| 679-019-4774 | West Ronaldo | Yes | |
| 793-831-8717 | Lake Norwood | Yes | |
| 993-857-6200 | Lake Lexus | Yes | |
| 100-470-4326 | South Alan | Yes | |
| 391-496-4282 | New Marcelleberg | Yes | |
| 422-683-1611 | Lake Yolanda | Yes | |
| 224-997-9712 | West Esthershire | No | |
| 750-090-6729 | Horaceshire | No | |
| 592-949-8440 | South Joelleville | Yes | |
| 703-894-8540 | West Jessiehaven | 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 |