vue-jstree
vue-jstree copied to clipboard
Get all selected nodes
how Get all selected nodes ?
I just found a solution somewhere on web like this.
setSelectedItems(){ this.selectedItems = [] this.$refs.tree.handleRecursionNodeChilds(this.$refs.tree, node => { if (typeof node.model!='undefined' && node.model.hasOwnProperty('selected') && node.model.selected) { this.selectedItems.push(node.model.value) } }) }
This is a method on Vue component. My VueJstree components ref is TREE. I put that method in itemSelect method. It gives all selected node values to SELECTEDITEM array. Thats it :)
thanks