0

How can I remove the checkboxes on the first column of the TreeGrid for the parent rows and only keep the checkboxes for the children rows? I've read countless articles and the only thing I found so far is setting the hide-checkbox-column attribute to true in the lightning-tree-grid component, but this removes all the checkboxes. Any help is much appreciated!

3

2 Answers 2

1

To have a custom logic for checkbox, to best of my knowledge you need to develop custom treegrid.

from high level perspective to develop acustom treegrid , you need to develop nested table structure.

please refer to treegrid blueprint: https://www.lightningdesignsystem.com/components/tree-grid/#site-main-content

Create a nested table using slds design.

use nested template for:each in lwc each for parent and child or aura:iteration in aura to show nested table data.

modify your nested json data containing parent and child in init of aura or connectecallback of lwc and add some custom property for your checkbox logic and to hide/show child data.

please also refer to a very basic custom implementation in lwc. https://webcomponents.dev/edit/k97nyPYUViWp2LBAIWXb/src/app.html?p=stories

1
  • 1
    Thank you so very much! I really apreciate it! I'll try what you recommended and let you know of the results. Commented May 3, 2022 at 4:55
0

You can use css to get this done:

.THIS tr[aria-level="1"]  > td[data-col-key-value="0-SELECTABLE_CHECKBOX-0"]{
    visibility:hidden !important;
 }

Might not be the best way to do it, but it worked for me... Cheers!

1
  • its not working when i tried.please put with example. Commented Feb 28, 2023 at 12:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .