Browse Source

无JIRA任务 treevaluechooer设置value和open后勾选子节点父节点不更新状态

es6
windy 3 years ago
parent
commit
2581d90f49
  1. 7
      src/component/treevaluechooser/abstract.treevaluechooser.js

7
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -556,6 +556,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
BI.each(nodes, function (idx, node) { BI.each(nodes, function (idx, node) {
allNodes = BI.concat(allNodes, self._getAllChildren(parentValues.concat([node.value]))); allNodes = BI.concat(allNodes, self._getAllChildren(parentValues.concat([node.value])));
}); });
var lastFind;
BI.each(allNodes, function (idx, node) { BI.each(allNodes, function (idx, node) {
var valueMap = dealWithSelectedValue(node.parentValues, selectedValues); var valueMap = dealWithSelectedValue(node.parentValues, selectedValues);
// REPORT-24409 fix: 设置节点全部展开,添加的节点没有给状态 // REPORT-24409 fix: 设置节点全部展开,添加的节点没有给状态
@ -566,7 +567,13 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
if (find) { if (find) {
parentCheckState.checked = find.halfCheck ? false : find.checked; parentCheckState.checked = find.halfCheck ? false : find.checked;
parentCheckState.half = find.halfCheck; parentCheckState.half = find.halfCheck;
// 默认展开也需要重置父节点的halfCheck
if (BI.isNotNull(lastFind) && (lastFind !== find || allNodes.length - 1 === idx)) {
lastFind.half = lastFind.halfCheck;
lastFind.halfCheck = false;
}
} }
lastFind = find;
var state = getCheckState(node.value, node.parentValues, valueMap, parentCheckState); var state = getCheckState(node.value, node.parentValues, valueMap, parentCheckState);
result.push({ result.push({
id: node.id, id: node.id,

Loading…
Cancel
Save