Browse Source

树控件

master
guy 8 years ago
parent
commit
97fe12f17d
  1. 25
      bi/widget.js
  2. 25
      docs/widget.js
  3. 25
      src/component/treevaluechooser/abstract.treevaluechooser.js

25
bi/widget.js

@ -17420,6 +17420,8 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function expandSelectedValue(selectedValues, parents, notSelectedValue) { function expandSelectedValue(selectedValues, parents, notSelectedValue) {
var next = selectedValues; var next = selectedValues;
var childrenCount = [];
var path = [];
//去掉点击的节点之后的结果集 //去掉点击的节点之后的结果集
BI.some(parents, function (i, v) { BI.some(parents, function (i, v) {
var t = next[v]; var t = next[v];
@ -17430,12 +17432,25 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
if (BI.isEmpty(next)) { if (BI.isEmpty(next)) {
var split = parents.slice(0, i); var split = parents.slice(0, i);
var expanded = self._getChildren(split); var expanded = self._getChildren(split);
BI.each(expanded, function (m, child) { path.push(split);
if (i === parents.length - 1 && child.value === notSelectedValue) { childrenCount.push(expanded.length);
return true; //如果只有一个值且取消的就是这个值
if (i === parents.length - 1 && expanded.length === 1 && expanded[0] === notSelectedValue) {
for (var j = childrenCount.length - 1; j >= 0; j--) {
if (childrenCount[j] === 1) {
self._deleteNode(selectedValues, path[j]);
} else {
break;
}
} }
next[child.value] = {}; } else {
}); BI.each(expanded, function (m, child) {
if (i === parents.length - 1 && child.value === notSelectedValue) {
return true;
}
next[child.value] = {};
});
}
next = next[v]; next = next[v];
} else { } else {
return true; return true;

25
docs/widget.js

@ -17420,6 +17420,8 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function expandSelectedValue(selectedValues, parents, notSelectedValue) { function expandSelectedValue(selectedValues, parents, notSelectedValue) {
var next = selectedValues; var next = selectedValues;
var childrenCount = [];
var path = [];
//去掉点击的节点之后的结果集 //去掉点击的节点之后的结果集
BI.some(parents, function (i, v) { BI.some(parents, function (i, v) {
var t = next[v]; var t = next[v];
@ -17430,12 +17432,25 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
if (BI.isEmpty(next)) { if (BI.isEmpty(next)) {
var split = parents.slice(0, i); var split = parents.slice(0, i);
var expanded = self._getChildren(split); var expanded = self._getChildren(split);
BI.each(expanded, function (m, child) { path.push(split);
if (i === parents.length - 1 && child.value === notSelectedValue) { childrenCount.push(expanded.length);
return true; //如果只有一个值且取消的就是这个值
if (i === parents.length - 1 && expanded.length === 1 && expanded[0] === notSelectedValue) {
for (var j = childrenCount.length - 1; j >= 0; j--) {
if (childrenCount[j] === 1) {
self._deleteNode(selectedValues, path[j]);
} else {
break;
}
} }
next[child.value] = {}; } else {
}); BI.each(expanded, function (m, child) {
if (i === parents.length - 1 && child.value === notSelectedValue) {
return true;
}
next[child.value] = {};
});
}
next = next[v]; next = next[v];
} else { } else {
return true; return true;

25
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -181,6 +181,8 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
function expandSelectedValue(selectedValues, parents, notSelectedValue) { function expandSelectedValue(selectedValues, parents, notSelectedValue) {
var next = selectedValues; var next = selectedValues;
var childrenCount = [];
var path = [];
//去掉点击的节点之后的结果集 //去掉点击的节点之后的结果集
BI.some(parents, function (i, v) { BI.some(parents, function (i, v) {
var t = next[v]; var t = next[v];
@ -191,12 +193,25 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
if (BI.isEmpty(next)) { if (BI.isEmpty(next)) {
var split = parents.slice(0, i); var split = parents.slice(0, i);
var expanded = self._getChildren(split); var expanded = self._getChildren(split);
BI.each(expanded, function (m, child) { path.push(split);
if (i === parents.length - 1 && child.value === notSelectedValue) { childrenCount.push(expanded.length);
return true; //如果只有一个值且取消的就是这个值
if (i === parents.length - 1 && expanded.length === 1 && expanded[0] === notSelectedValue) {
for (var j = childrenCount.length - 1; j >= 0; j--) {
if (childrenCount[j] === 1) {
self._deleteNode(selectedValues, path[j]);
} else {
break;
}
} }
next[child.value] = {}; } else {
}); BI.each(expanded, function (m, child) {
if (i === parents.length - 1 && child.value === notSelectedValue) {
return true;
}
next[child.value] = {};
});
}
next = next[v]; next = next[v];
} else { } else {
return true; return true;

Loading…
Cancel
Save