Toggle Side Panel

  • Blogs
  • 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
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Blogs
    • 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
    • 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, 11 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

    • [adinserter block='9']
    • 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

    Popular Salesforce Blogs

    Integrations in Salesforce

    Integrations in Salesforce | All You Need to Know

    Blog in Salesforce integration

    So, let’s study integration in Salesforce!  Why do we need Integration? So, we need integration when we want to connect two or more systems together. For…

    API, API Endpoint, Authorization, Callout, data
    bhawana Apr 19, 2023
    1,810  Views

    How to Prove the Value of a Salesforce Partner to Your CFO

    Blog in Salesforce

    Asking for more money is hard. When you go to your Chief Financial Officer (CFO) to ask for help with Salesforce, you need proof. You…

    Salesforce CRM, Salesforce Development, salesforce partners, salesforce-crm-sysytem
    TechForce Jan 20, 2026
    216  Views

    What is the Future Scope of Salesforce CRM?

    Blog in Salesforce

    Nowadays the adoption of Salesforce CRM is increasing at a tremendous pace. As per reports, Salesforce dominated the worldwide CRM market with a market share…

    AppExchange, Build Applications, Business Relationships, cloud marketplace, Consultants
    DianApps Dec 8, 2022
    2,621  Views

    Popular Salesforce Videos

    Salesforce CEO Marc Benioff on New Software to Help Businesses Reopen

    Salesforce CEO Marc Benioff on New Software to Help Businesses Reopen

    Video in Salesforce Stories, Salesforce Products

    Marc Benioff, founder, chairman and CEO of Salesforce, joins CNBC's Jim Cramer to discuss the company's new initiatives to help businesses reopen. Salesforce announced a…

    salesforce, Salesforce Video, Pandemic, Corona Virus, Workdotcom
    Pooja May 5, 2020
    2,565  Views
    Getting Started With Business Analysis | Scrum Development Model | Salesforce Tutorial

    Getting Started With Business Analysis | Scrum Development Model | Salesforce Tutorial

    Video in Others, Salesforce Training, Salesforce Development

    Learn all about AGILE software development and the scrum development model. 1. Introduction To AGILE Get a brief definition of AGILE and its different modules.…

    Salesforce Training, Salesforce Tutorial, Agile, Salesforce Video, Business Analysis
    Algoworks Feb 8, 2021
    2,519  Views
    Mastering the VLookUp Function | Salesforce Tutorial

    Mastering the VLookUp Function | Salesforce Tutorial

    Video in Salesforce Training, Salesforce Admin

    Watch this amazing video tutorial and follow these steps to effectively use the VLookUp function for data import purposes in your Salesforce database. If you…

    Salesforce Training, Salesforce Tutorial, Salesforce Data, Salesforce Database, Salesforce Video
    SkyPlanner Jun 17, 2021
    4,087  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

    © 2026 - 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®.

    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.