Replies: 2 comments 2 replies
-
We'll keep this in mind. Currently, the selection API is declarative and I'll have to discuss supporting alternate APIs, as the logic can compete and make things difficult to maintain. In the meantime, I would avoid using private APIs and use this instead: tree.querySelectorAll('sl-tree-item').forEach(item => {
item.indeterminate = false;
item.selected = false
}); https://codepen.io/claviska/pen/eYbxxRq?editors=0010 @alenaksu What are your thoughts on adding a method to make this easier? |
Beta Was this translation helpful? Give feedback.
-
Supposing I had read https://shoelace.style/components/tree-item#properties and realized I could set |
Beta Was this translation helpful? Give feedback.
-
What issue are you having?
Another page change resets the items in my sl-tree, but the item at the previously-selected index stays selected.
Describe the solution you'd like
mySlTreeEl.clearSelection();
or
mySlTreeEl.selectedItems=[];
Describe alternatives you've considered
(el as any).selectItem(null);
:)Beta Was this translation helpful? Give feedback.
All reactions