he-tree-vue icon indicating copy to clipboard operation
he-tree-vue copied to clipboard

How to get a list of checked items?

Open TNortnern opened this issue 4 years ago • 3 comments

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

TNortnern avatar Jun 30 '21 01:06 TNortnern

function getAllChekced(){
  const checked = [];
  tree.walkTreeData((node) => {
    node.$checked && checked.push(node)
  })
  return checked
}

phphe avatar Jun 30 '21 10:06 phphe

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.

TNortnern avatar Jun 30 '21 14:06 TNortnern

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

phphe avatar Jul 14 '21 07:07 phphe