You need to sign in to do that
Don't have an account?
bw admin
lightning treegrid selection goes away on expand/collapse
I am using lightning:treegrid to display hierarchy of accounts.
When I select a child from the hierarchy and then collapse its parent and expand again - the selection is gone.
This is also reproducible in the lightning component library
https://developer.salesforce.com/docs/component-library/bundle/lightning:treeGrid/example
Expand/Collapse should not affect any selection.
When I select a child from the hierarchy and then collapse its parent and expand again - the selection is gone.
This is also reproducible in the lightning component library
https://developer.salesforce.com/docs/component-library/bundle/lightning:treeGrid/example
Expand/Collapse should not affect any selection.
All you need to do is this:
Component.cmp
ComponentController.js
Give a thumbs up if this helps you!
Thanks!
Modify the onrowselection event's handler to include event as a parameter, then read the value from event.detail.config.action, if you are collapsing/expanding a row it should be undefined, if you select a row its value should be "rowSelect" and if you are deselecting the row it should be "rowDeSelect".
In this way you can add logic inside the onrowselection method:
Salesforce is yet to document this behaviour in Lightning-tree-grid documentation.