Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › What is the use of lightning:treeGrid in lightning component in Salesforce?

    Tagged: Account Hierarchy, Forecasting, JS Controller, Lightning Tree, Salesforce Lightning Component

    • Salesforce® Discussions

      What is the use of lightning:treeGrid in lightning component in Salesforce?

      Posted by Deepak on September 3, 2019 at 1:24 PM

      What is the use of lightning:tree Grid in lightning component in salesforce?

      Achintya replied 6 years, 3 months ago 4 Members · 3 Replies
      • Account Hierarchy
      • Forecasting
      • JS Controller
      • Lightning Tree
      • Salesforce Lightning Component
    • 3 Replies
    • Hariom Chaudhary

      Member
      September 4, 2019 at 5:13 AM

      Hi,

      A lightning:treeGrid in lightning component displays hierarchical data in a table

    • Saddam

      Member
      September 4, 2019 at 6:35 AM

      Hi Deepak,

      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. This visual representation is useful for displaying structured data such as account hierarchy or forecasting data. Each column can be displayed based on the data type. For example, a phone number is displayed as a hyperlink with the tel: URL scheme by specifying the phone type.

    • Achintya

      Member
      September 4, 2019 at 10:09 AM

      Lightning:treeGrid component displays hierarchical data in a table. Its appearance resembles lightning: data table, 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. Each column can be displayed based on the data type. Here is an example of lightning:datatable.

      Apex Controller:

      public class SampleAuraController {
           
          @AuraEnabled
          public static List <Account> getAccountList() {
              List<Account> accList = new List<Account>();
              accList = [SELECT Id, Name, NumberOfEmployees, Phone,
                         (SELECT FirstName, LastName, Email FROM Contacts)
                         FROM Account LIMIT 10];
              return accList;
          }
      }

      Lightning Component:

      <aura:component controller="SampleAuraController" implements="flexipage:availableForAllPageTypes" access="global">
          <aura:attribute type="Account[]" name="acctList"/>
          <aura:attribute name="gridColumns" type="List" />
          <aura:attribute name="gridData" type="Object" />
          <aura:attribute name="gridExpandedRows" type="Object" />
          <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
          <div class="slds-m-around_xx-large">
              <lightning:treeGrid aura:id="accTree" columns="{!v.gridColumns}" data="{!v.gridData}" keyField="Id"/>
          </div>
      </aura:component>

      Lightning Component JS Controller:

      ({
          doInit : function(component, event, helper) {
              var columns = [
                  {
                      type: 'text',
                      fieldName: 'Name',
                      label: 'Account Name'
                  },
                  {
                      type: 'number',
                      fieldName: 'NumberOfEmployees',
                      label: 'Employees'
                  },
                  {
                      type: 'phone',
                      fieldName: 'Phone',
                      label: 'Phone Number'
                  },
                  {
                      type: 'text',
                      fieldName: 'FirstName',
                      label: 'First Name'
                  },
                  {
                      type: 'text',
                      fieldName: 'LastName',
                      label: 'Last Name'
                  },
                  {
                      type: 'email',
                      fieldName: 'Email',
                      label: 'Email'
                  }
              ];
              component.set('v.gridColumns', columns);
              var action = component.get("c.getAccountList");
              action.setCallback(this, function(response){
                  var state = response.getState();
                  if (state === "SUCCESS" ) {
                      var resultData = response.getReturnValue();
                      for (var i=0; i<resultData.length; i++ ) {
                          resultData[i]._children = resultData[i]['Contacts'];
                          delete resultData[i].Contacts; 
                      }
                      component.set('v.gridData', resultData);
                  }
              });
              $A.enqueueAction(action);
          }
      })

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    application solution

    Popular Salesforce Blogs

    Batch Apex in Salesforce

    All You Need to Know about Batch Apex in Salesforce

    Blog in Salesforce Apex

    Contents: What is Batch Apex? Batch Apex is a very powerful asynchronous process introduced by Salesforce. Which is used to process a large number of…

    Apex Transaction, Apex Triggers Salesforce, Asynchronous Process, Batch Apex, Batch Apex Classes
    ABHISHEK SHUKLA Jun 30, 2022
    3,619  Views

    Why Should Organizations Consider Outsourcing Their Salesforce Development?

    Blog in Salesforce Consultant

    As a top-rated CRM, Salesforce can be leveraged by businesses to increase their sales and productivity. Besides helping organizations manage their business processes, the cloud-based…

    Business Process, Client Relationship, Cloud Based CRM, Cost Cutting, Cost Savings
    Girikon Apr 13, 2022
    2,308  Views
    Choosing the Right Cloud Consulting Company: A Decision-Making Guide

    Choosing the Right Cloud Consulting Company: A Decision-Making Guide

    Blog in Others

    Do you wish to leverage cloud technologies or want to migrate your business to the cloud? If so, you are making a great choice! Cloud…

    Business Objectives, Client Reviews, CLOUD, Cloud Adoption, Cloud Assessments
    Cyntexa May 27, 2024
    617  Views

    Popular Salesforce Videos

    How To Create Workflow Rules In Salesforce | Salesforce Workflow Rules

    How To Create Workflow Rules In Salesforce | Salesforce Workflow Rules

    Video in Salesforce Training

    This video walks through the steps to create a Workflow Rule within the Process Automation section of Lightning Settings in Salesforce. Get answers to the…

    Salesforce Training, Salesforce Tutorial, Salesforce Lightning, Process Automation, salesforce
    Algoworks Sep 16, 2021
    1,435  Views
    Salesforce Summer '18 Release

    Salesforce Summer '18 Release

    Video in Salesforce Products

    I can’t believe Summer ’18 is already here in no time. I don’t know about all of you, but I still have my winter stuff…

    Salesforce Products, Salesforce Lightning Experience, Salesforce Einstein, Machine Learning, Salesforce Release Management
    Shiv Kumar Sharma May 5, 2018
    1,947  Views
    Deploy Lightning Web Component Files | Salesforce Lightning Tutorial

    Deploy Lightning Web Component Files | Salesforce Lightning Tutorial

    Video in Lightning, Salesforce Training

    Learning Objectives After watching this video, you’ll be able to: Configure Lightning web component files for display in an org. Deploy your files to an…

    Salesforce Training, Salesforce Lightning, Salesforce Lightning Tutorial, Salesforce Video, LWC
    Abhishek Jun 14, 2021
    1,896  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2025 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.