riophae / vue-treeselect

A multi-select component with nested options support for Vue.js
https://vue-treeselect.js.org/
MIT License
2.89k stars 505 forks source link

Issue manually clearing and autopopulating #530

Open Jjenkins3538 opened 1 year ago

Jjenkins3538 commented 1 year ago

Hi, I have a pretty unique use case (from what I saw), the client would like the ability to add a new item to the drop down list and have it auto-select the select dropdown with the most recently created item. This is no problem, however the problem arises when trying to add a new item while the treeselect is already populated, and making the old item clear and the new one auto-select.

I tried clearing the v-model, I tried using vanilla javascript and removing/editing the inner and outer html of all the child components within the single-value select

.

I also tried manually using this.$refs.tree.select(this.$refs.tree.getNode(id)) and that will select the correct node the first time, but any subsequent time the node's value will change (if logged) but the html value in the input stays the same and does not update.

I've tried forcing the behavior anyway I know how.

Thanks!