phphe/he-tree-vue

How to get a list of checked items?

TNortnern opened this issue · 3 comments

Using @change only shows individual item getting checked. How I get a collection of all current checked items?

phphe commented
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.

phphe commented

I tested. The getAllChekced function above is able to get all checked. The walkTreeData function will walk all nodes.