N00ts/vue3-treeview

Programatically set focused node

muzicaed opened this issue · 1 comments

Hi!

Thanks for a really nice library!
I have a use case that I think is not covered with the current implementation.

I use this component to display a folder structure in my project. The idea is that the user should use the tree to select a parent for an item. This works perfectly when creating a new item by using the node-focus event to see what node was selected.

But, when the user wants to edit an item in my application, I see no way to programatically select a node in the tree. Ie. I have the selected id from database and I want to display the tree with that particular node pre-selected in the tree.

Im not sure if there currently is a way to do this that Im not seeing or if this might be a missing feature?

I found a way using the check boxes. When checking a box I just programatically unchecked last checked and thereby forcing a "singel selection". This was actually better, as the focus was removed when eg. clicking on another field etc.