N00ts / vue3-treeview

a simple treeview in vue js 3
MIT License
71 stars 61 forks source link

Feature request: Ability to open any child #39

Closed Faisal49m closed 1 year ago

Faisal49m commented 1 year ago

I'm implementing a search feature with this plugin and I was able to search through all nodes and get the result however I'm unable to expand the node found in the search result, tried to set the state to opened but that didn't work

Thanks

nclemeur commented 1 year ago

Yes, I agree it would definitely be a good addition to have a api to emulate what can be done using the mouse. For example, I would like to programmatically focus on a node in the tree... But I could not find a nice way to do it... I believe this issue is also similar to issue #37

Lisiadito commented 1 year ago

I used the state opened for a different feature and it worked. Do you set the open state on all parent nodes as well @Faisal49m ?

nclemeur commented 1 year ago

Yes, this is what I end up doing as well and it worked when I started to initialise the state as a reactive (All the nodes structures is build in a ref), I am not sure exactly what was the issue, but it can work to mutate the state directly.

Faisal49m commented 1 year ago

@Lisiadito Yes after opening all parents it worked thanks

Faisal49m commented 1 year ago

As @Lisiadito mentioned, opening all parents does the job