function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sohan ShirodkarSohan Shirodkar 

Lightning:treegrid ontoggle action triggers onrowselection

<lightning:treeGrid aura:id="accountsTreeComponent"
                    columns="{!v.gridColumns}"
            	    data="{!v.gridData}"
                    keyField="accountId"
                    expandedRows="{! v.gridExpandedRows }"
                    isLoading="{! v.isLoading }"
                    ontoggle="{! c.handleRowToggle }"
                    onrowselection="{!c.onRowSelection}"/>

This is how I am using treegrid component.

When I expand a treegrid row, and then collapse it, automatically onrowselection event is fired, which calls onRowSelection action handler in JS controller.

I have made an important observation. This issue occurs in the following scenario:
1) Expand a row (onrowtoggle fired)
2) Select a child row(onrowselection fired)
3) Collapse the parent row (onrowtoggle fired + onrowselection fired)
I believe step 3 internally deselects the child row selected in step 2 which results in firing of onrowselect event. This is certainly a faulty behaviour.

How can I prevent this or at least handle it?
-_--_-
Hi Sohan, were you ever able to figure this out?  I am running into the exact same issue with hierarchical data and am unable to add select/de-select all functionality due to this issue.

any guideance would be greatly appreciated!