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

    Modifiers in Apex

    Concept of Virtual and Abstract Modifiers in Apex | Salesforce Developer Guide

    Blog in Salesforce Apex

    Implementing the Virtual or Abstract modifiers in the class makes it inheritable by any other class present in Salesforce. Let us understand each of them…

    childClass, Code, doDIfference, Method Definition, Override Keyword
    Anurag algoworks Feb 5, 2021
    34,816  Views
    Salesforce Community Cloud

    Salesforce Product : Community Cloud

    Blog in Salesforce Cloud Platform

    Salesforce Product: Community Cloud Community Cloud can determine either a portal, a help forum, a support site, HR central, or something else, an online community…

    Business Client Customer Support Community, Cloud Platform, Customer Service, Individual Client Customer Support Community, Salesforce Cloud Platform
    Archit Feb 14, 2018
    6,215  Views

    Importance of Salesforce and Financial Services Industry

    Blog in Salesforce Consultant

    In the rapidly evolving landscape of the financial services industry, leveraging technology is essential for staying competitive and meeting customer expectations. Salesforce has emerged as…

    Certified Salesforce Experts, managed services provider, Salesforce Automation, Salesforce Best practices, Salesforce Business Growth
    Codleo Sep 19, 2024
    496  Views

    Popular Salesforce Videos

    Salesforce + WhatsApp Integration Announcement

    Salesforce + WhatsApp Integration Announcement

    Video in Salesforce Integration

    Salesforce + WhatsApp Integration Announcement. Watch this video to learn all about the famous Salesforce + WhatsApp integration, if you have any doubts or concerns,…

    Salesforce Training, Salesforce Tutorial, Salesforce Integration, Salesforce VIdeos, Salesforce Learning
    SFDC Oct 27, 2022
    1,254  Views
    How to Download Backup Files from Salesforce Using UIPath Robots

    How to Download Backup Files from Salesforce Using UIPath Robots

    Video in Salesforce Stories, Salesforce Integration

    How to download backup files from Salesforce using UiPath robots. How to get the latest file from the folder: Directory.GetFiles(“YOUR FOLDER”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).First The link…

    Salesforce Training, salesforce, SFDC, Salesforce Video, Salesforce Learning
    Cristian Nov 9, 2020
    2,191  Views
    Which Certification Is Needed In Salesforce for Getting Job?

    Which Certification Is Needed In Salesforce for Getting Job?

    Video in Salesforce Training

    Want to get a job in the Salesforce industry? Wondering which certifications are going to help. Join this useful group for Salesforce job & career…

    Salesforce Training, Salesforce Tutorial, Salesforce Certifications, Salesforce Jobs, Salesforce Industry
    Intelogik Sep 14, 2022
    1,138  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.