How does a lightning treegrid work in Salesforce?
A lightning:treeGrid component displays hierarchical data in a table. Its appearance resembles lightning:datatable, with the exception that each row can be expanded to reveal a nested group of items. Rows that contain nested data display a chevron icon to denote that they can be expanded or collapsed.
How does the onrowselection event handler work in Lightning?
Selecting the checkbox enables you to select the entire row of data and triggers the onrowselection event handler. The expandedRows attribute is optional, which expands nested items on a row when provided. The client-side controller creates selectable rows with or without nested data.
What can the tree grid be used for?
The tree grid can be used to display accounts with contacts as nested items. Create an Apex controller that queries the fields you want to display. In this case, the controller returns the contacts for each account. Wire this up to your component via the controller attribute.
What do actions mean in Lightning Tree grid?
Header-level actions refer to tasks you can perform on a column of data, while row-level actions refer to tasks you can perform on a row of data, such as updating or deleting the row. Creating actions in lightning-tree-grid is similar to creating actions in lightning-datatable.
How are columns formatted in Lightning Tree grid?
Each column’s formatting is determined by its data type. For example, a phone number is displayed as a hyperlink with the tel: URL scheme by specifying the phone type. The default type is text. This component implements the tree grid blueprint in the Lightning Design System.
How to hide checkbox in Lightning Tree grid?
A checkbox is displayed by default in the first column. The hide-checkbox-column attribute removes the checkbox. Initialize your tree grid data using the data, columns, and key-field attributes and define their values in JavaScript. Note that key-field is required.