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, 7 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

    How Will Generative CRM Shape Your Business?

    How Will Generative CRM Shape Your Business?

    Blog in Salesforce

    Table of Contents   How Will Generative CRM Shape Your Business? What is Generative CRM? Impact on Business FAQs How Will Generative CRM Shape Your…

    Artificial Intelligence, Competitive Advantage, CRM, CRM Implementation, CRM systems
    Kizzy Consulting May 2, 2024
    597  Views

    How Can Small Businesses Grow Faster With Salesforce Essentials?

    Blog in Salesforce

    Small businesses often face unique challenges on their path to growth. Efficient customer relationship management (CRM), streamlined processes, and data-driven decision-making are critical to overcoming…

    Automated Follow-Ups, Business Efficiency, Business Health, Contact Management, Customer Relationship Management
    Codleo Jul 19, 2024
    746  Views
    Vaccine Cloud

    Salesforce Introduces Vaccine Cloud to Accelerate Global Vaccine Management

    Blog in Salesforce, Salesforce Cloud Platform

    To help government agencies, healthcare organizations, businesses, nonprofits, and educational institutions, Salesforce, the global leader in CRM, has introduced Vaccine Cloud. By launching the Vaccine…

    Businesses, COVID-19, CRM, Easy Management and Tracking, Education
    Kcloud Feb 4, 2021
    2,523  Views

    Popular Salesforce Videos

    How to Edit List View Filters in Accounts and Contacts Tabs | Salesforce

    How to Edit List View Filters in Accounts and Contacts Tabs | Salesforce

    Video in Salesforce Training

    Watch this video to learn How to Edit List View Filters in ‘Accounts’ and ‘Contacts’ Tabs. If you find anything confusing or have any questions,…

    Salesforce Training, Salesforce Tutorial, Salesforce Apex, salesforce, Salesforce Video
    Rupal Kakkar Mar 9, 2022
    2,302  Views
    Lightning Component Development - 01 - Basic of Lightning Framework, Component Bundle, App Builder

    Lightning Component Development - 01 - Basic of Lightning Framework, Component Bundle, App Builder

    Video in Lightning

    What is covered in this session? * What is Lightning Component Framework? * Lightning Component Across Salesforce Ecosystem * When to use lightning component? * Where…

    Salesforce Development, Salesforce Apex, salesforce training videos for beginners, Free Salesforce Training, Salesforce Lightning
    Shiv Kumar Sharma May 21, 2018
    2,851  Views
    Business Days in Salesforce CRM Analytics (Tableau CRM)

    Business Days in Salesforce CRM Analytics (Tableau CRM)

    Video in Analytics

    It's common for businesses to want to take business days into account when showing data on a dashboard in CRM Analytics (formerly Tableau CRM) to…

    Salesforce Training, Salesforce Sales Cloud, salesforce, Apex, Business Logic
    DB Aug 12, 2022
    1,803  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®.

    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.