Browse Source

BI-71788 fix: allvaluechoosercombo setValue所有值trigger显示部分选择

master
windy 4 years ago
parent
commit
96919cf0ba
  1. 15
      src/component/allvaluechooser/abstract.allvaluechooser.js
  2. 8
      src/component/allvaluechooser/combo.allvaluechooser.js

15
src/component/allvaluechooser/abstract.allvaluechooser.js

@ -82,5 +82,20 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, {
hasNext: false hasNext: false
}); });
} }
},
_assertValue: function (v) {
v = v || {};
var value = v;
if (BI.isNotNull(this.items)) {
var isAllSelect = BI.difference(BI.map(this.items, "value"), v.value).length === 0;
if (isAllSelect) {
value = {
type: BI.Selection.All,
value: [],
};
} }
}
return value;
},
}); });

8
src/component/allvaluechooser/combo.allvaluechooser.js

@ -33,10 +33,10 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, {
valueFormatter: BI.bind(this._valueFormatter, this), valueFormatter: BI.bind(this._valueFormatter, this),
width: o.width, width: o.width,
height: o.height, height: o.height,
value: { value: this._assertValue({
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: o.value || [] value: o.value || []
} })
}); });
this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () {
@ -45,10 +45,10 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, {
}, },
setValue: function (v) { setValue: function (v) {
this.combo.setValue({ this.combo.setValue(this._assertValue({
type: BI.Selection.Multi, type: BI.Selection.Multi,
value: v || [] value: v || []
}); }));
}, },
getValue: function () { getValue: function () {

Loading…
Cancel
Save