Create dynamic tree grid with expande / collapse selected rows and select checkbox for the entire row select/deselect in Salesforce lightning web component LWC | how to create tree grid with expanded/collapsed section for the entire row marked as select / deselect with checkbox in Salesforce LWC
Hey guys, today in this post we are going to learn about How to Create dynamic tree grid with expanded/collapsed selected rows and select checkbox for the entire row select/deselect in Salesforce lightning web component LWC.
A lightning-tree-grid component displays hierarchical data in a table. Its appearance resembles lightning-datatable since it implements lightning-datatable internally, with the exception that each row in the table 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. To know more details about lightning-tree-grid, Click Here..
This component implements the tree grid blueprint in the Lightning Design System.
Inline editing and sorting of columns are not supported.
Supported features include.
- Displaying and formatting of columns with appropriate data types
- Header-level actions
- Row-level actions
- Resizing of columns
- Selecting of rows
- Text wrapping and clipping
Files we used to create lightning tree grid in Salesforce LWC →
lwcTreeGrid.html
LWc HTML File
Template HTML file to display expande/collapse selected rows in Salesforce Lightning Web Component (LWC)
lwcTreeGrid.js
LWC JavaScript File
It’s hold getCurrentExpandedRows action method to retrieve the list of rows in Salesforce LWC.
sampleData.js
LWC JavaScript File
It’s export the gridData for expanded rows in Salesforce LWC.
lwcTreeGrid.css
Style CSS
It’s fill the background color on the page in Salesforce LWC.
lwcTreeGrid.js-meta.xml
XML Meta File
It is used to where this lightning web component file you want to display as lightning__AppPage, lightning__RecordPage, lightning__HomePage.
Final Output → Get source code live demo, Click Here..

Other related post that would you like to learn in LWC
Create Lightning Web Component HTML →
Step 1:- Create Lightning Web Component : lwcTreeGrid.html
SFDX:Lightning Web Component >> New >> lwcTreeGrid.html
lwcTreeGrid.html [Lightning Web Component HTML]
Create Lightning Web Component JavaScript →
Step 2:- Create Lightning Web Component : lwcTreeGrid.js
SFDX:Lightning Web Component >> New >> lwcTreeGrid.js
lwcTreeGrid.js [LWC JavaScript File]
Create Lightning Web Component JavaScript →
Step 3:- Create Lightning Web Component : sampleData.js
SFDX:Lightning Web Component >> New >> sampleData.js
sampleData.js [LWC JavaScript File]
Create Component Style CSS →
Step 4:- Create Lightning Web Component : lwcTreeGrid.css
SFDX:Lightning Web Component >> New >> lwcTreeGrid.css
lwcTreeGrid.css [Style CSS]
Create Lightning Web Component Meta XML →
Step 5:- Create Lightning Web Component : lwcTreeGrid.js-meta.xml
SFDX:Lightning Web Component >> New >> lwcTreeGrid.js-meta.xml
lwcTreeGrid.js-meta.xml [LWC Meta Data XML]
Lightning Web Component Meta XML
Further post that would you like to learn in LWC
Flyout is a free, simple way to earn money.
If you think you and your family members also like to earn money in additional time, then go this link. In this site, you can earn money for the lifetime at low effort. To Earn Unlimited Everyday With This Trick, Sign Up Free.. Get Started for Free
Flyout is a free, simple way to earn money by placing sponsored content on your blog
Check Out:- Earn Unlimited Everyday With This Trick:- Click Here
FAQ (Frequently Asked Questions)
Final Output → Get source code live demo, Click Here..
Related Topics | You May Also Like
Hi, This is Vijay behind the admin and founder of w3web.net. I am a senior software developer and working in MNC company from more than 8 years. I am great fan of technology, configuration, customization & development. Apart of this, I love to write about Blogging in spare time, Working on Mobile & Web application development, Salesforce lightning, Salesforce LWC and Salesforce Integration development in full time. [Read full bio] | The Sitemap where you can find all published post on w3web.net
Categories Tags Salesforce LWC, checkbox for the entire row select/deselect in lwc, create tree grid dynamic in lwc, dynamic tree grid in lwc, dynamic tree grid with show/hide in lwc, entire row select/deselect with checkbox in lwc, lightning tree grid in salesforce lwc, lightning tree grid show/hide row in lwc, lightning-tree lwc, lightning-tree-grid with show/hide in lwc, lightning:treegrid onrowaction in lwc, lightning:treegrid selectedrows in lwc, select entire row select/deselect with checkbox in lwc, slds-tree grid, tree grid dynamic expand collapse in lwc, tree grid example in lwc, tree grid in lightning web component, tree grid Salesforce lwc, tree grid with expanded/collapsed in lwcTutorial
Originally published at https://www.w3web.net on December 4, 2021.