Browse Source

setSelectedValue

es6
young 8 years ago
parent
commit
7625121824
  1. 21
      bi/widget.js
  2. 21
      docs/widget.js
  3. 8
      src/component/treevaluechooser/abstract.treevaluechooser.js
  4. 4
      src/component/treevaluechooser/pane.treevaluechooser.js
  5. 4
      src/widget/multiselecttree/multiselecttree.js
  6. 5
      src/widget/multiselecttree/multiselecttree.popup.js

21
bi/widget.js

@ -11429,6 +11429,10 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, },
setSelectedValue: function (v) {
this.adapter.setSelectedValue(v);
},
setValue: function (v) { setValue: function (v) {
this.storeValue.value = v || {}; this.storeValue.value = v || {};
this.adapter.setValue({ this.adapter.setValue({
@ -11496,6 +11500,11 @@ BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
this.popup.setValue(v.value); this.popup.setValue(v.value);
}, },
setSelectedValue: function (v) {
v || (v = {});
this.popup.setSelectedValue(v);
},
updateValue: function (v) { updateValue: function (v) {
this.popup.updateValue(v); this.popup.updateValue(v);
this.popup.refresh(); this.popup.refresh();
@ -17586,11 +17595,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var times = op.times; var times = op.times;
var checkState = op.checkState || {}; var checkState = op.checkState || {};
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues; var selectedValues = op.selectedValues || {};
var valueMap = {}; var valueMap = {};
if (judgeState(parentValues, selectedValues, checkState)) { // if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues); valueMap = dealWidthSelectedValue(parentValues, selectedValues);
} // }
var nodes = this._getChildren(parentValues); var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState); var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
@ -17623,7 +17632,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function dealWidthSelectedValue(parentValues, selectedValues) { function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {}; var valueMap = {};
BI.each(parentValues, function (i, v) { BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v]; selectedValues = selectedValues[v] || {};
}); });
BI.each(selectedValues, function (value, obj) { BI.each(selectedValues, function (value, obj) {
if (BI.isNull(obj)) { if (BI.isNull(obj)) {
@ -17810,6 +17819,10 @@ BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, {
} }
}, },
setSelectedValue: function (v) {
this.pane.setSelectedValue(v);
},
setValue: function (v) { setValue: function (v) {
this.pane.setValue(v); this.pane.setValue(v);
}, },

21
docs/widget.js

@ -11429,6 +11429,10 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, },
setSelectedValue: function (v) {
this.adapter.setSelectedValue(v);
},
setValue: function (v) { setValue: function (v) {
this.storeValue.value = v || {}; this.storeValue.value = v || {};
this.adapter.setValue({ this.adapter.setValue({
@ -11496,6 +11500,11 @@ BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
this.popup.setValue(v.value); this.popup.setValue(v.value);
}, },
setSelectedValue: function (v) {
v || (v = {});
this.popup.setSelectedValue(v);
},
updateValue: function (v) { updateValue: function (v) {
this.popup.updateValue(v); this.popup.updateValue(v);
this.popup.refresh(); this.popup.refresh();
@ -17586,11 +17595,11 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
var times = op.times; var times = op.times;
var checkState = op.checkState || {}; var checkState = op.checkState || {};
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues; var selectedValues = op.selectedValues || {};
var valueMap = {}; var valueMap = {};
if (judgeState(parentValues, selectedValues, checkState)) { // if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues); valueMap = dealWidthSelectedValue(parentValues, selectedValues);
} // }
var nodes = this._getChildren(parentValues); var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState); var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
@ -17623,7 +17632,7 @@ BI.shortcut('bi.all_value_chooser_pane', BI.AllValueChooserPane);BI.AbstractTree
function dealWidthSelectedValue(parentValues, selectedValues) { function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {}; var valueMap = {};
BI.each(parentValues, function (i, v) { BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v]; selectedValues = selectedValues[v] || {};
}); });
BI.each(selectedValues, function (value, obj) { BI.each(selectedValues, function (value, obj) {
if (BI.isNull(obj)) { if (BI.isNull(obj)) {
@ -17810,6 +17819,10 @@ BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, {
} }
}, },
setSelectedValue: function (v) {
this.pane.setSelectedValue(v);
},
setValue: function (v) { setValue: function (v) {
this.pane.setValue(v); this.pane.setValue(v);
}, },

8
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -407,11 +407,11 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
var times = op.times; var times = op.times;
var checkState = op.checkState || {}; var checkState = op.checkState || {};
var parentValues = op.parentValues || []; var parentValues = op.parentValues || [];
var selectedValues = op.selectedValues; var selectedValues = op.selectedValues || {};
var valueMap = {}; var valueMap = {};
if (judgeState(parentValues, selectedValues, checkState)) { // if (judgeState(parentValues, selectedValues, checkState)) {
valueMap = dealWidthSelectedValue(parentValues, selectedValues); valueMap = dealWidthSelectedValue(parentValues, selectedValues);
} // }
var nodes = this._getChildren(parentValues); var nodes = this._getChildren(parentValues);
for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) { for (var i = (times - 1) * this._const.perPage; nodes[i] && i < times * this._const.perPage; i++) {
var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState); var state = getCheckState(nodes[i].value, parentValues, valueMap, checkState);
@ -444,7 +444,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
function dealWidthSelectedValue(parentValues, selectedValues) { function dealWidthSelectedValue(parentValues, selectedValues) {
var valueMap = {}; var valueMap = {};
BI.each(parentValues, function (i, v) { BI.each(parentValues, function (i, v) {
selectedValues = selectedValues[v]; selectedValues = selectedValues[v] || {};
}); });
BI.each(selectedValues, function (value, obj) { BI.each(selectedValues, function (value, obj) {
if (BI.isNull(obj)) { if (BI.isNull(obj)) {

4
src/component/treevaluechooser/pane.treevaluechooser.js

@ -33,6 +33,10 @@ BI.TreeValueChooserPane = BI.inherit(BI.AbstractTreeValueChooser, {
} }
}, },
setSelectedValue: function (v) {
this.pane.setSelectedValue(v);
},
setValue: function (v) { setValue: function (v) {
this.pane.setValue(v); this.pane.setValue(v);
}, },

4
src/widget/multiselecttree/multiselecttree.js

@ -126,6 +126,10 @@ BI.MultiSelectTree = BI.inherit(BI.Widget, {
}, },
setSelectedValue: function (v) {
this.adapter.setSelectedValue(v);
},
setValue: function (v) { setValue: function (v) {
this.storeValue.value = v || {}; this.storeValue.value = v || {};
this.adapter.setValue({ this.adapter.setValue({

5
src/widget/multiselecttree/multiselecttree.popup.js

@ -37,6 +37,11 @@ BI.MultiSelectTreePopup = BI.inherit(BI.Widget, {
this.popup.setValue(v.value); this.popup.setValue(v.value);
}, },
setSelectedValue: function (v) {
v || (v = {});
this.popup.setSelectedValue(v);
},
updateValue: function (v) { updateValue: function (v) {
this.popup.updateValue(v); this.popup.updateValue(v);
this.popup.refresh(); this.popup.refresh();

Loading…
Cancel
Save