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

    salesforce consultant

    How to Select a Certified Salesforce Consultant?

    Blog in Others, Salesforce Consultant

    Cloud computing was always there in one form or another, but it has started to really develop in the past half-decade or so. Salesforce is…

    Certified Salesforce Consultant, Cloud Based Customer Relationship Management Software, Cloud Computing, CRM to Salesforce, Development and Operational Strategy
    Algoworks May 14, 2020
    2,773  Views

    Unlocking the Power of Salesforce Data Cloud for Tableau

    Blog in Salesforce

    Salesforce Data Cloud is a powerful data management platform that enables organizations to access and analyze their data in a more efficient, insightful, and actionable…

    Appheinz, Automated Insights, Behavioral Data, Business Growth, Clean Data
    Apphienz Apr 26, 2023
    1,727  Views
    Salesforce sales cloud

    Salesforce Sales Cloud Innovations – Your Key to Higher Revenue

    Blog in Sales, Salesforce Cloud Platform

    Sales have gone through a tremendous evolution over the years, starting from door-to-door to using advanced technologies. And now they’ve stepped into a hybrid age…

    B2B Buying, Boost Sales, Business, CRM, Customer Expectations
    Grazitti Jun 27, 2022
    2,396  Views

    Popular Salesforce Videos

    Simplified Non-Functional Testing for Salesforce Developers

    Simplified Non-Functional Testing for Salesforce Developers

    Video in Salesforce Training

    Testing is indispensable to measure, optimize performance, and improve user experience. Watch this video to see how you can measure performance across physical mobile devices…

    Salesforce Training, Salesforce Tutorial, Salesforce Integration, salesforce, User Experience
    Pooja Oct 26, 2021
    1,979  Views
    APIs and Integration for the Salesforce Platform

    APIs and Integration for the Salesforce Platform

    Video in Salesforce Integration

    Watch this session to learn how you can integrate with the Salesforce Platform. We'll demonstrate features, APIs, and techniques for integrating with Salesforce Core, Heroku,…

    Salesforce Training, Salesforce Tutorial, Salesforce Integration, salesforce platform, Salesforce Video
    Abhishek Apr 28, 2021
    2,605  Views
    Dreamforce 2021 Main Keynote - Welcome to the Trusted Enterprise | Salesforce

    Dreamforce 2021 Main Keynote - Welcome to the Trusted Enterprise | Salesforce

    Video in Salesforce Stories

    Today, every business has to transform to become a Trusted Enterprise. Join Marc Benioff & special guests to learn how Customer 360 helps businesses of…

    Salesforce Training, Salesforce Tutorial, dreamforce, salesforce, salesforce knowledge
    Nauman Oct 5, 2021
    2,640  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.