diff --git a/src/component/allvaluechooser/abstract.allvaluechooser.js b/src/component/allvaluechooser/abstract.allvaluechooser.js index 332a1737d..1f30e8de8 100644 --- a/src/component/allvaluechooser/abstract.allvaluechooser.js +++ b/src/component/allvaluechooser/abstract.allvaluechooser.js @@ -82,5 +82,20 @@ BI.AbstractAllValueChooser = BI.inherit(BI.Widget, { 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; + }, }); \ No newline at end of file diff --git a/src/component/allvaluechooser/combo.allvaluechooser.js b/src/component/allvaluechooser/combo.allvaluechooser.js index 3b7306a6a..8c170867a 100644 --- a/src/component/allvaluechooser/combo.allvaluechooser.js +++ b/src/component/allvaluechooser/combo.allvaluechooser.js @@ -33,10 +33,10 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, height: o.height, - value: { + value: this._assertValue({ type: BI.Selection.Multi, value: o.value || [] - } + }) }); this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { @@ -45,10 +45,10 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { }, setValue: function (v) { - this.combo.setValue({ + this.combo.setValue(this._assertValue({ type: BI.Selection.Multi, value: v || [] - }); + })); }, getValue: function () {