Commit 02459f18 authored by Dreamacro's avatar Dreamacro Committed by 杨奕

Tree: fix setCheckedKeys

parent 476f7687
...@@ -301,7 +301,6 @@ export default class Node { ...@@ -301,7 +301,6 @@ export default class Node {
child.setChecked(isCheck, deep, true, passValue); child.setChecked(isCheck, deep, true, passValue);
} }
const { half, all } = getChildState(childNodes); const { half, all } = getChildState(childNodes);
console.log(this.data.label, all);
if (!all) { if (!all) {
this.checked = all; this.checked = all;
this.indeterminate = half; this.indeterminate = half;
......
...@@ -188,11 +188,10 @@ export default class TreeStore { ...@@ -188,11 +188,10 @@ export default class TreeStore {
} }
_setCheckedKeys(key, leafOnly = false, checkedKeys) { _setCheckedKeys(key, leafOnly = false, checkedKeys) {
let allNodes = this._getAllNodes().sort((a, b) => a.level - b.level); const allNodes = this._getAllNodes().sort((a, b) => b.level - a.level);
const keys = Object.keys(checkedKeys); const keys = Object.keys(checkedKeys);
for (let node of allNodes) { for (let node of allNodes) {
let checked = keys.indexOf(node.data[key].toString()) > -1; let checked = keys.indexOf(node.data[key] + '') > -1;
if (!checked) { if (!checked) {
node.setChecked(false, false); node.setChecked(false, false);
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment