he-tree-vue
he-tree-vue copied to clipboard
How to get a list of checked items?
Using @change only shows individual item getting checked. How I get a collection of all current checked items?
function getAllChekced(){
const checked = [];
tree.walkTreeData((node) => {
node.$checked && checked.push(node)
})
return checked
}
Yeah this works for top level nodes but not children. I think there should be a onChecked event that sends all the items that were checked back to the parent. So if you check a top level parent then you should receive the top level and the children.
I tested. The getAllChekced function above is able to get all checked. The walkTreeData function will walk all nodes.