From 2dac2ee1f7e57898b6915573ef59afe4b1689e04 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Thu, 18 Jan 2018 17:03:23 +0800 Subject: [PATCH] =?UTF-8?q?multiselectcombo=E5=92=8Cmultiselecttree?= =?UTF-8?q?=E6=94=AF=E6=8C=81value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multiselect/demo.multi_select_combo.js | 6 +- .../widget/multitree/demo.multi_tree_combo.js | 5 +- dist/base.js | 8 +- dist/bundle.js | 108 +++++++++++++----- dist/case.js | 11 +- dist/demo.js | 11 +- dist/fineui.js | 108 +++++++++++++----- dist/widget.js | 89 +++++++++++---- src/base/layer/layer.popup.js | 3 +- src/base/tree/treeview.js | 5 +- src/case/editor/editor.state.js | 3 + src/case/editor/editor.state.simple.js | 3 + src/case/list/list.select.js | 3 + src/case/trigger/trigger.icon.text.js | 2 +- .../allvaluechooser/combo.allvaluechooser.js | 6 +- .../check/multiselect.check.pane.js | 2 +- .../multiselect/multiselect..insert.combo.js | 4 +- src/widget/multiselect/multiselect.combo.js | 9 +- src/widget/multiselect/multiselect.loader.js | 6 +- .../multiselect/multiselect.popup.view.js | 6 +- src/widget/multiselect/multiselect.trigger.js | 6 +- .../search/multiselect.search.loader.js | 3 +- .../search/multiselect.search.pane.js | 3 +- .../trigger/button.checkselected.js | 5 +- .../multiselect/trigger/editor.multiselect.js | 3 +- .../trigger/searcher.multiselect.js | 6 +- .../trigger/switcher.checkselected.js | 6 +- .../multitree/check/multi.tree.check.pane.js | 3 +- src/widget/multitree/multi.tree.combo.js | 9 +- src/widget/multitree/multi.tree.popup.js | 3 +- .../multitree/multi.tree.search.pane.js | 3 +- .../multitree/trigger/searcher.multi.tree.js | 6 +- 32 files changed, 342 insertions(+), 112 deletions(-) diff --git a/demo/js/widget/multiselect/demo.multi_select_combo.js b/demo/js/widget/multiselect/demo.multi_select_combo.js index a2bcec439..79ecca7aa 100644 --- a/demo/js/widget/multiselect/demo.multi_select_combo.js +++ b/demo/js/widget/multiselect/demo.multi_select_combo.js @@ -11,7 +11,11 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, { var widget = BI.createWidget({ type: "bi.multi_select_combo", itemsCreator: BI.bind(this._itemsCreator, this), - width: 200 + width: 200, + value: { + type: 1, + value: ["柳州市城贸金属材料有限责任公司", "柳州市建福房屋租赁有限公司", "柳州市迅昌数码办公设备有限责任公司"] + } }); widget.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { diff --git a/demo/js/widget/multitree/demo.multi_tree_combo.js b/demo/js/widget/multitree/demo.multi_tree_combo.js index 5134c714c..fcc9107cb 100644 --- a/demo/js/widget/multitree/demo.multi_tree_combo.js +++ b/demo/js/widget/multitree/demo.multi_tree_combo.js @@ -35,7 +35,10 @@ Demo.MultiTreeCombo = BI.inherit(BI.Widget, { items: items }); }, - width: 300 + width: 300, + value: { + "根目录": {} + } }, { type: "bi.button", text: "getValue", diff --git a/dist/base.js b/dist/base.js index 6ba66fcd0..35451c74c 100644 --- a/dist/base.js +++ b/dist/base.js @@ -1535,6 +1535,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }, _init: function () { BI.TreeView.superclass._init.apply(this, arguments); + var o = this.options; this._stop = false; this._createTree(); @@ -1550,7 +1551,9 @@ BI.TreeView = BI.inherit(BI.Pane, { element: this, items: [this.tip] }); - + if(BI.isNotNull(o.value)){ + this.setSelectedValue(o.value); + } }, _createTree: function () { @@ -15438,7 +15441,8 @@ BI.PopupView = BI.inherit(BI.Widget, { type: "bi.center", cls: "list-view-tab", height: 25, - items: o.tabs + items: o.tabs, + value: o.value }); }, diff --git a/dist/bundle.js b/dist/bundle.js index 68f34cf03..ec4d03c2d 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -27408,6 +27408,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }, _init: function () { BI.TreeView.superclass._init.apply(this, arguments); + var o = this.options; this._stop = false; this._createTree(); @@ -27423,7 +27424,9 @@ BI.TreeView = BI.inherit(BI.Pane, { element: this, items: [this.tip] }); - + if(BI.isNotNull(o.value)){ + this.setSelectedValue(o.value); + } }, _createTree: function () { @@ -41311,7 +41314,8 @@ BI.PopupView = BI.inherit(BI.Widget, { type: "bi.center", cls: "list-view-tab", height: 25, - items: o.tabs + items: o.tabs, + value: o.value }); }, @@ -69561,6 +69565,9 @@ BI.StateEditor = BI.inherit(BI.Widget, { items: [this.editor] }); this._showHint(); + if(BI.isNotNull(o.text)){ + this.setState(o.text); + } }, doRedMark: function () { @@ -69835,6 +69842,9 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { items: [this.editor] }); this._showHint(); + if(BI.isNotNull(o.text)){ + this.setState(o.text); + } }, doRedMark: function () { @@ -70461,6 +70471,9 @@ BI.SelectList = BI.inherit(BI.Widget, { this.toolbar.setVisible(false); this.toolbar.setEnable(false); } + if(BI.isNotNull(o.value)){ + this.setValue(o.value); + } }, _checkAllSelected: function () { @@ -76069,7 +76082,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { }, disableSelected: true }, - width: o.triggerWidth || o.height + width: BI.isEmptyString(o.iconCls)? 0 : (o.triggerWidth || o.height) }, { el: this.text @@ -85521,7 +85534,7 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { var self = this, opts = this.options; - this.storeValue = {}; + this.storeValue = opts.value || {}; this.display = BI.createWidget({ type: "bi.display_selected_list", items: opts.items, @@ -85735,7 +85748,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { } callback.apply(self, arguments); }); - } + }, + value: o.value }); this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { @@ -85844,6 +85858,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { }); } }, + value: o.value, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } @@ -86066,7 +86081,10 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { self.trigger.getSearcher().setState(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue); }; - this.storeValue = {}; + this.storeValue = o.value || {}; + + this._assertValue(this.storeValue); + // 标记正在请求数据 this.requesting = false; @@ -86091,7 +86109,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { } callback.apply(self, arguments); }); - } + }, + value: this.storeValue }); this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { @@ -86196,6 +86215,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }); } }, + value: o.value, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } @@ -86446,6 +86466,9 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { var self = this, opts = this.options; var hasNext = false; + this.storeValue = opts.value || {}; + this._assertValue(this.storeValue); + this.button_group = BI.createWidget({ type: "bi.select_list", element: this, @@ -86512,7 +86535,8 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { }, hasNext: function () { return hasNext; - } + }, + value: this.storeValue }); this.button_group.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -86611,7 +86635,8 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { type: "bi.multi_select_loader", itemsCreator: opts.itemsCreator, valueFormatter: opts.valueFormatter, - onLoaded: opts.onLoaded + onLoaded: opts.onLoaded, + value: opts.value }); this.popupView = BI.createWidget({ @@ -86622,7 +86647,8 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { maxHeight: opts.maxHeight, element: this, buttons: [BI.i18nText("BI-Basic_Clears"), BI.i18nText("BI-Basic_Sure")], - el: this.loader + el: this.loader, + value: opts.value }); this.popupView.on(BI.MultiPopupView.EVENT_CHANGE, function () { @@ -86717,7 +86743,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { valueFormatter: o.valueFormatter, popup: {}, adapter: o.adapter, - masker: o.masker + masker: o.masker, + value: o.value }); this.searcher.on(BI.MultiSelectSearcher.EVENT_START, function () { self.fireEvent(BI.MultiSelectTrigger.EVENT_START); @@ -86739,7 +86766,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { valueFormatter: o.valueFormatter, itemsCreator: o.itemsCreator, adapter: o.adapter, - masker: o.masker + masker: o.masker, + value: o.value }); this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { self.fireEvent(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK); @@ -86849,13 +86877,14 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { var self = this, opts = this.options; var hasNext = false; - + this.storeValue = BI.deepClone(opts.value); this.button_group = BI.createWidget({ type: "bi.select_list", element: this, logic: { dynamic: false }, + value: opts.value, el: { tipText: BI.i18nText("BI-No_Select"), el: { @@ -87024,7 +87053,8 @@ BI.MultiSelectSearchPane = BI.inherit(BI.Widget, { callback(res); self.setKeyword(o.keywordGetter()); }]); - } + }, + value: o.value }); this.loader.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -87101,7 +87131,7 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { _init: function () { BI.MultiSelectCheckSelectedButton.superclass._init.apply(this, arguments); - var self = this; + var self = this, o = this.options; this.numberCounter = BI.createWidget({ type: "bi.text_button", element: this, @@ -87125,6 +87155,9 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { self.numberCounter.setText(self.numberCounter.getTag()); }); this.setVisible(false); + if(BI.isNotNull(o.value)){ + this.setValue(o.value); + } }, setValue: function (ob) { @@ -87183,7 +87216,8 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, { element: this, height: o.height, watermark: BI.i18nText("BI-Basic_Search"), - allowBlank: true + allowBlank: true, + value: o.value }); this.editor.on(BI.Controller.EVENT_CHANGE, function () { @@ -87286,7 +87320,8 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { op.keyword = self.editor.getValue(); this.setKeyword(op.keyword); o.itemsCreator(op, callback); - } + }, + value: o.value }, o.popup), adapter: o.adapter, @@ -87311,6 +87346,9 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { var keywords = this.getKeywords(); self.fireEvent(BI.MultiSelectSearcher.EVENT_SEARCHING, keywords); }); + if(BI.isNotNull(o.value)){ + this.setState(o.value); + } }, adjustView: function () { @@ -87430,7 +87468,8 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { this.button = BI.createWidget(o.el, { type: "bi.multi_select_check_selected_button", - itemsCreator: o.itemsCreator + itemsCreator: o.itemsCreator, + value: o.value }); this.button.on(BI.Events.VIEW, function () { self.fireEvent(BI.Events.VIEW, arguments); @@ -87446,7 +87485,8 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { itemsCreator: o.itemsCreator, onClickContinueSelect: function () { self.switcher.hideView(); - } + }, + value: o.value }, o.popup), adapter: o.adapter, masker: o.masker @@ -88452,7 +88492,8 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { itemsCreator: function (op, callback) { op.type = BI.TreeView.REQ_TYPE_GET_SELECTED_DATA; opts.itemsCreator(op, callback); - } + }, + value: (opts.value || {}).value }); this.display.on(BI.Events.AFTERINIT, function () { @@ -88535,6 +88576,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { var isInit = false; var want2showCounter = false; + this.storeValue = {value: o.value || {}}; + this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", height: o.height, @@ -88554,7 +88597,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { type: "bi.multi_tree_check_pane", itemsCreator: o.itemsCreator } - } + }, + value: {value: o.value || {}} }); @@ -88610,12 +88654,12 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { }); } }, + value: {value: o.value || {}}, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } }); - - this.storeValue = {value: {}}; + var change = false; var clear = false; // 标识当前是否点击了清空 @@ -88792,7 +88836,8 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, { height: 400, cls: "popup-view-tree", itemsCreator: opts.itemsCreator, - onLoaded: opts.onLoaded + onLoaded: opts.onLoaded, + value: opts.value || {} }); this.popupView = BI.createWidget({ @@ -88888,7 +88933,8 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, { itemsCreator: function (op, callback) { op.keyword = opts.keywordGetter(); opts.itemsCreator(op, callback); - } + }, + value: opts.value }); this.partTree.on(BI.Controller.EVENT_CHANGE, function () { @@ -89052,7 +89098,8 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { itemsCreator: function (op, callback) { op.keyword = self.editor.getValue(); o.itemsCreator(op, callback); - } + }, + value: o.value }, o.popup), adapter: o.adapter, @@ -89073,6 +89120,9 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { self.fireEvent(BI.MultiTreeSearcher.EVENT_CHANGE, arguments); }); + if (BI.isNotNull(o.value)) { + this.setState(o.value); + } }, adjustView: function () { @@ -97671,7 +97721,11 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, - height: o.height + height: o.height, + value: { + type: BI.Selection.Multi, + value: o.value || [] + } }); this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { diff --git a/dist/case.js b/dist/case.js index 09b2cfe90..0c36f02d0 100644 --- a/dist/case.js +++ b/dist/case.js @@ -7271,6 +7271,9 @@ BI.StateEditor = BI.inherit(BI.Widget, { items: [this.editor] }); this._showHint(); + if(BI.isNotNull(o.text)){ + this.setState(o.text); + } }, doRedMark: function () { @@ -7545,6 +7548,9 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { items: [this.editor] }); this._showHint(); + if(BI.isNotNull(o.text)){ + this.setState(o.text); + } }, doRedMark: function () { @@ -8171,6 +8177,9 @@ BI.SelectList = BI.inherit(BI.Widget, { this.toolbar.setVisible(false); this.toolbar.setEnable(false); } + if(BI.isNotNull(o.value)){ + this.setValue(o.value); + } }, _checkAllSelected: function () { @@ -13779,7 +13788,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { }, disableSelected: true }, - width: o.triggerWidth || o.height + width: BI.isEmptyString(o.iconCls)? 0 : (o.triggerWidth || o.height) }, { el: this.text diff --git a/dist/demo.js b/dist/demo.js index 55d4d61df..cd7bbe6f6 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -12621,7 +12621,11 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, { var widget = BI.createWidget({ type: "bi.multi_select_combo", itemsCreator: BI.bind(this._itemsCreator, this), - width: 200 + width: 200, + value: { + type: 1, + value: ["柳州市城贸金属材料有限责任公司", "柳州市建福房屋租赁有限公司", "柳州市迅昌数码办公设备有限责任公司"] + } }); widget.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { @@ -12727,7 +12731,10 @@ Demo.MultiTreeCombo = BI.inherit(BI.Widget, { items: items }); }, - width: 300 + width: 300, + value: { + "根目录": {} + } }, { type: "bi.button", text: "getValue", diff --git a/dist/fineui.js b/dist/fineui.js index caa19278c..5610722eb 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -29102,6 +29102,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }, _init: function () { BI.TreeView.superclass._init.apply(this, arguments); + var o = this.options; this._stop = false; this._createTree(); @@ -29117,7 +29118,9 @@ BI.TreeView = BI.inherit(BI.Pane, { element: this, items: [this.tip] }); - + if(BI.isNotNull(o.value)){ + this.setSelectedValue(o.value); + } }, _createTree: function () { @@ -43005,7 +43008,8 @@ BI.PopupView = BI.inherit(BI.Widget, { type: "bi.center", cls: "list-view-tab", height: 25, - items: o.tabs + items: o.tabs, + value: o.value }); }, @@ -71255,6 +71259,9 @@ BI.StateEditor = BI.inherit(BI.Widget, { items: [this.editor] }); this._showHint(); + if(BI.isNotNull(o.text)){ + this.setState(o.text); + } }, doRedMark: function () { @@ -71529,6 +71536,9 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { items: [this.editor] }); this._showHint(); + if(BI.isNotNull(o.text)){ + this.setState(o.text); + } }, doRedMark: function () { @@ -72155,6 +72165,9 @@ BI.SelectList = BI.inherit(BI.Widget, { this.toolbar.setVisible(false); this.toolbar.setEnable(false); } + if(BI.isNotNull(o.value)){ + this.setValue(o.value); + } }, _checkAllSelected: function () { @@ -77763,7 +77776,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { }, disableSelected: true }, - width: o.triggerWidth || o.height + width: BI.isEmptyString(o.iconCls)? 0 : (o.triggerWidth || o.height) }, { el: this.text @@ -87215,7 +87228,7 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { var self = this, opts = this.options; - this.storeValue = {}; + this.storeValue = opts.value || {}; this.display = BI.createWidget({ type: "bi.display_selected_list", items: opts.items, @@ -87429,7 +87442,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { } callback.apply(self, arguments); }); - } + }, + value: o.value }); this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { @@ -87538,6 +87552,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { }); } }, + value: o.value, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } @@ -87760,7 +87775,10 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { self.trigger.getSearcher().setState(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue); }; - this.storeValue = {}; + this.storeValue = o.value || {}; + + this._assertValue(this.storeValue); + // 标记正在请求数据 this.requesting = false; @@ -87785,7 +87803,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { } callback.apply(self, arguments); }); - } + }, + value: this.storeValue }); this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { @@ -87890,6 +87909,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }); } }, + value: o.value, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } @@ -88140,6 +88160,9 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { var self = this, opts = this.options; var hasNext = false; + this.storeValue = opts.value || {}; + this._assertValue(this.storeValue); + this.button_group = BI.createWidget({ type: "bi.select_list", element: this, @@ -88206,7 +88229,8 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { }, hasNext: function () { return hasNext; - } + }, + value: this.storeValue }); this.button_group.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -88305,7 +88329,8 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { type: "bi.multi_select_loader", itemsCreator: opts.itemsCreator, valueFormatter: opts.valueFormatter, - onLoaded: opts.onLoaded + onLoaded: opts.onLoaded, + value: opts.value }); this.popupView = BI.createWidget({ @@ -88316,7 +88341,8 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { maxHeight: opts.maxHeight, element: this, buttons: [BI.i18nText("BI-Basic_Clears"), BI.i18nText("BI-Basic_Sure")], - el: this.loader + el: this.loader, + value: opts.value }); this.popupView.on(BI.MultiPopupView.EVENT_CHANGE, function () { @@ -88411,7 +88437,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { valueFormatter: o.valueFormatter, popup: {}, adapter: o.adapter, - masker: o.masker + masker: o.masker, + value: o.value }); this.searcher.on(BI.MultiSelectSearcher.EVENT_START, function () { self.fireEvent(BI.MultiSelectTrigger.EVENT_START); @@ -88433,7 +88460,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { valueFormatter: o.valueFormatter, itemsCreator: o.itemsCreator, adapter: o.adapter, - masker: o.masker + masker: o.masker, + value: o.value }); this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { self.fireEvent(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK); @@ -88543,13 +88571,14 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { var self = this, opts = this.options; var hasNext = false; - + this.storeValue = BI.deepClone(opts.value); this.button_group = BI.createWidget({ type: "bi.select_list", element: this, logic: { dynamic: false }, + value: opts.value, el: { tipText: BI.i18nText("BI-No_Select"), el: { @@ -88718,7 +88747,8 @@ BI.MultiSelectSearchPane = BI.inherit(BI.Widget, { callback(res); self.setKeyword(o.keywordGetter()); }]); - } + }, + value: o.value }); this.loader.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -88795,7 +88825,7 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { _init: function () { BI.MultiSelectCheckSelectedButton.superclass._init.apply(this, arguments); - var self = this; + var self = this, o = this.options; this.numberCounter = BI.createWidget({ type: "bi.text_button", element: this, @@ -88819,6 +88849,9 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { self.numberCounter.setText(self.numberCounter.getTag()); }); this.setVisible(false); + if(BI.isNotNull(o.value)){ + this.setValue(o.value); + } }, setValue: function (ob) { @@ -88877,7 +88910,8 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, { element: this, height: o.height, watermark: BI.i18nText("BI-Basic_Search"), - allowBlank: true + allowBlank: true, + value: o.value }); this.editor.on(BI.Controller.EVENT_CHANGE, function () { @@ -88980,7 +89014,8 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { op.keyword = self.editor.getValue(); this.setKeyword(op.keyword); o.itemsCreator(op, callback); - } + }, + value: o.value }, o.popup), adapter: o.adapter, @@ -89005,6 +89040,9 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { var keywords = this.getKeywords(); self.fireEvent(BI.MultiSelectSearcher.EVENT_SEARCHING, keywords); }); + if(BI.isNotNull(o.value)){ + this.setState(o.value); + } }, adjustView: function () { @@ -89124,7 +89162,8 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { this.button = BI.createWidget(o.el, { type: "bi.multi_select_check_selected_button", - itemsCreator: o.itemsCreator + itemsCreator: o.itemsCreator, + value: o.value }); this.button.on(BI.Events.VIEW, function () { self.fireEvent(BI.Events.VIEW, arguments); @@ -89140,7 +89179,8 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { itemsCreator: o.itemsCreator, onClickContinueSelect: function () { self.switcher.hideView(); - } + }, + value: o.value }, o.popup), adapter: o.adapter, masker: o.masker @@ -90146,7 +90186,8 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { itemsCreator: function (op, callback) { op.type = BI.TreeView.REQ_TYPE_GET_SELECTED_DATA; opts.itemsCreator(op, callback); - } + }, + value: (opts.value || {}).value }); this.display.on(BI.Events.AFTERINIT, function () { @@ -90229,6 +90270,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { var isInit = false; var want2showCounter = false; + this.storeValue = {value: o.value || {}}; + this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", height: o.height, @@ -90248,7 +90291,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { type: "bi.multi_tree_check_pane", itemsCreator: o.itemsCreator } - } + }, + value: {value: o.value || {}} }); @@ -90304,12 +90348,12 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { }); } }, + value: {value: o.value || {}}, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } }); - - this.storeValue = {value: {}}; + var change = false; var clear = false; // 标识当前是否点击了清空 @@ -90486,7 +90530,8 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, { height: 400, cls: "popup-view-tree", itemsCreator: opts.itemsCreator, - onLoaded: opts.onLoaded + onLoaded: opts.onLoaded, + value: opts.value || {} }); this.popupView = BI.createWidget({ @@ -90582,7 +90627,8 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, { itemsCreator: function (op, callback) { op.keyword = opts.keywordGetter(); opts.itemsCreator(op, callback); - } + }, + value: opts.value }); this.partTree.on(BI.Controller.EVENT_CHANGE, function () { @@ -90746,7 +90792,8 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { itemsCreator: function (op, callback) { op.keyword = self.editor.getValue(); o.itemsCreator(op, callback); - } + }, + value: o.value }, o.popup), adapter: o.adapter, @@ -90767,6 +90814,9 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { self.fireEvent(BI.MultiTreeSearcher.EVENT_CHANGE, arguments); }); + if (BI.isNotNull(o.value)) { + this.setState(o.value); + } }, adjustView: function () { @@ -99365,7 +99415,11 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, - height: o.height + height: o.height, + value: { + type: BI.Selection.Multi, + value: o.value || [] + } }); this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { diff --git a/dist/widget.js b/dist/widget.js index 56dcea129..5af512637 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -9120,7 +9120,7 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { var self = this, opts = this.options; - this.storeValue = {}; + this.storeValue = opts.value || {}; this.display = BI.createWidget({ type: "bi.display_selected_list", items: opts.items, @@ -9334,7 +9334,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { } callback.apply(self, arguments); }); - } + }, + value: o.value }); this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { @@ -9443,6 +9444,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { }); } }, + value: o.value, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } @@ -9665,7 +9667,10 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { self.trigger.getSearcher().setState(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue); }; - this.storeValue = {}; + this.storeValue = o.value || {}; + + this._assertValue(this.storeValue); + // 标记正在请求数据 this.requesting = false; @@ -9690,7 +9695,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { } callback.apply(self, arguments); }); - } + }, + value: this.storeValue }); this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { @@ -9795,6 +9801,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }); } }, + value: o.value, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } @@ -10045,6 +10052,9 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { var self = this, opts = this.options; var hasNext = false; + this.storeValue = opts.value || {}; + this._assertValue(this.storeValue); + this.button_group = BI.createWidget({ type: "bi.select_list", element: this, @@ -10111,7 +10121,8 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { }, hasNext: function () { return hasNext; - } + }, + value: this.storeValue }); this.button_group.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -10210,7 +10221,8 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { type: "bi.multi_select_loader", itemsCreator: opts.itemsCreator, valueFormatter: opts.valueFormatter, - onLoaded: opts.onLoaded + onLoaded: opts.onLoaded, + value: opts.value }); this.popupView = BI.createWidget({ @@ -10221,7 +10233,8 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { maxHeight: opts.maxHeight, element: this, buttons: [BI.i18nText("BI-Basic_Clears"), BI.i18nText("BI-Basic_Sure")], - el: this.loader + el: this.loader, + value: opts.value }); this.popupView.on(BI.MultiPopupView.EVENT_CHANGE, function () { @@ -10316,7 +10329,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { valueFormatter: o.valueFormatter, popup: {}, adapter: o.adapter, - masker: o.masker + masker: o.masker, + value: o.value }); this.searcher.on(BI.MultiSelectSearcher.EVENT_START, function () { self.fireEvent(BI.MultiSelectTrigger.EVENT_START); @@ -10338,7 +10352,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { valueFormatter: o.valueFormatter, itemsCreator: o.itemsCreator, adapter: o.adapter, - masker: o.masker + masker: o.masker, + value: o.value }); this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { self.fireEvent(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK); @@ -10448,13 +10463,14 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { var self = this, opts = this.options; var hasNext = false; - + this.storeValue = BI.deepClone(opts.value); this.button_group = BI.createWidget({ type: "bi.select_list", element: this, logic: { dynamic: false }, + value: opts.value, el: { tipText: BI.i18nText("BI-No_Select"), el: { @@ -10623,7 +10639,8 @@ BI.MultiSelectSearchPane = BI.inherit(BI.Widget, { callback(res); self.setKeyword(o.keywordGetter()); }]); - } + }, + value: o.value }); this.loader.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); @@ -10700,7 +10717,7 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { _init: function () { BI.MultiSelectCheckSelectedButton.superclass._init.apply(this, arguments); - var self = this; + var self = this, o = this.options; this.numberCounter = BI.createWidget({ type: "bi.text_button", element: this, @@ -10724,6 +10741,9 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { self.numberCounter.setText(self.numberCounter.getTag()); }); this.setVisible(false); + if(BI.isNotNull(o.value)){ + this.setValue(o.value); + } }, setValue: function (ob) { @@ -10782,7 +10802,8 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, { element: this, height: o.height, watermark: BI.i18nText("BI-Basic_Search"), - allowBlank: true + allowBlank: true, + value: o.value }); this.editor.on(BI.Controller.EVENT_CHANGE, function () { @@ -10885,7 +10906,8 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { op.keyword = self.editor.getValue(); this.setKeyword(op.keyword); o.itemsCreator(op, callback); - } + }, + value: o.value }, o.popup), adapter: o.adapter, @@ -10910,6 +10932,9 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { var keywords = this.getKeywords(); self.fireEvent(BI.MultiSelectSearcher.EVENT_SEARCHING, keywords); }); + if(BI.isNotNull(o.value)){ + this.setState(o.value); + } }, adjustView: function () { @@ -11029,7 +11054,8 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { this.button = BI.createWidget(o.el, { type: "bi.multi_select_check_selected_button", - itemsCreator: o.itemsCreator + itemsCreator: o.itemsCreator, + value: o.value }); this.button.on(BI.Events.VIEW, function () { self.fireEvent(BI.Events.VIEW, arguments); @@ -11045,7 +11071,8 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { itemsCreator: o.itemsCreator, onClickContinueSelect: function () { self.switcher.hideView(); - } + }, + value: o.value }, o.popup), adapter: o.adapter, masker: o.masker @@ -12051,7 +12078,8 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { itemsCreator: function (op, callback) { op.type = BI.TreeView.REQ_TYPE_GET_SELECTED_DATA; opts.itemsCreator(op, callback); - } + }, + value: (opts.value || {}).value }); this.display.on(BI.Events.AFTERINIT, function () { @@ -12134,6 +12162,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { var isInit = false; var want2showCounter = false; + this.storeValue = {value: o.value || {}}; + this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", height: o.height, @@ -12153,7 +12183,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { type: "bi.multi_tree_check_pane", itemsCreator: o.itemsCreator } - } + }, + value: {value: o.value || {}} }); @@ -12209,12 +12240,12 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { }); } }, + value: {value: o.value || {}}, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } }); - - this.storeValue = {value: {}}; + var change = false; var clear = false; // 标识当前是否点击了清空 @@ -12391,7 +12422,8 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, { height: 400, cls: "popup-view-tree", itemsCreator: opts.itemsCreator, - onLoaded: opts.onLoaded + onLoaded: opts.onLoaded, + value: opts.value || {} }); this.popupView = BI.createWidget({ @@ -12487,7 +12519,8 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, { itemsCreator: function (op, callback) { op.keyword = opts.keywordGetter(); opts.itemsCreator(op, callback); - } + }, + value: opts.value }); this.partTree.on(BI.Controller.EVENT_CHANGE, function () { @@ -12651,7 +12684,8 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { itemsCreator: function (op, callback) { op.keyword = self.editor.getValue(); o.itemsCreator(op, callback); - } + }, + value: o.value }, o.popup), adapter: o.adapter, @@ -12672,6 +12706,9 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { self.fireEvent(BI.MultiTreeSearcher.EVENT_CHANGE, arguments); }); + if (BI.isNotNull(o.value)) { + this.setState(o.value); + } }, adjustView: function () { @@ -21270,7 +21307,11 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, - height: o.height + height: o.height, + value: { + type: BI.Selection.Multi, + value: o.value || [] + } }); this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { diff --git a/src/base/layer/layer.popup.js b/src/base/layer/layer.popup.js index f84b378b1..5b011efc3 100644 --- a/src/base/layer/layer.popup.js +++ b/src/base/layer/layer.popup.js @@ -115,7 +115,8 @@ BI.PopupView = BI.inherit(BI.Widget, { type: "bi.center", cls: "list-view-tab", height: 25, - items: o.tabs + items: o.tabs, + value: o.value }); }, diff --git a/src/base/tree/treeview.js b/src/base/tree/treeview.js index 9a7dbe5bd..31a1cc499 100644 --- a/src/base/tree/treeview.js +++ b/src/base/tree/treeview.js @@ -14,6 +14,7 @@ BI.TreeView = BI.inherit(BI.Pane, { }, _init: function () { BI.TreeView.superclass._init.apply(this, arguments); + var o = this.options; this._stop = false; this._createTree(); @@ -29,7 +30,9 @@ BI.TreeView = BI.inherit(BI.Pane, { element: this, items: [this.tip] }); - + if(BI.isNotNull(o.value)){ + this.setSelectedValue(o.value); + } }, _createTree: function () { diff --git a/src/case/editor/editor.state.js b/src/case/editor/editor.state.js index c9aa8d289..bcdaf8e43 100644 --- a/src/case/editor/editor.state.js +++ b/src/case/editor/editor.state.js @@ -129,6 +129,9 @@ BI.StateEditor = BI.inherit(BI.Widget, { items: [this.editor] }); this._showHint(); + if(BI.isNotNull(o.text)){ + this.setState(o.text); + } }, doRedMark: function () { diff --git a/src/case/editor/editor.state.simple.js b/src/case/editor/editor.state.simple.js index 481b9e1b7..eb67bfb97 100644 --- a/src/case/editor/editor.state.simple.js +++ b/src/case/editor/editor.state.simple.js @@ -130,6 +130,9 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { items: [this.editor] }); this._showHint(); + if(BI.isNotNull(o.text)){ + this.setState(o.text); + } }, doRedMark: function () { diff --git a/src/case/list/list.select.js b/src/case/list/list.select.js index 617f07c63..d28967013 100644 --- a/src/case/list/list.select.js +++ b/src/case/list/list.select.js @@ -80,6 +80,9 @@ BI.SelectList = BI.inherit(BI.Widget, { this.toolbar.setVisible(false); this.toolbar.setEnable(false); } + if(BI.isNotNull(o.value)){ + this.setValue(o.value); + } }, _checkAllSelected: function () { diff --git a/src/case/trigger/trigger.icon.text.js b/src/case/trigger/trigger.icon.text.js index f387b0da1..8a65e7e3a 100644 --- a/src/case/trigger/trigger.icon.text.js +++ b/src/case/trigger/trigger.icon.text.js @@ -52,7 +52,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { }, disableSelected: true }, - width: o.triggerWidth || o.height + width: BI.isEmptyString(o.iconCls)? 0 : (o.triggerWidth || o.height) }, { el: this.text diff --git a/src/component/allvaluechooser/combo.allvaluechooser.js b/src/component/allvaluechooser/combo.allvaluechooser.js index 2e4e1ef4a..ab85db3a2 100644 --- a/src/component/allvaluechooser/combo.allvaluechooser.js +++ b/src/component/allvaluechooser/combo.allvaluechooser.js @@ -31,7 +31,11 @@ BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { itemsCreator: BI.bind(this._itemsCreator, this), valueFormatter: BI.bind(this._valueFormatter, this), width: o.width, - height: o.height + height: o.height, + value: { + type: BI.Selection.Multi, + value: o.value || [] + } }); this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { diff --git a/src/widget/multiselect/check/multiselect.check.pane.js b/src/widget/multiselect/check/multiselect.check.pane.js index 0abdb024c..006d5b695 100644 --- a/src/widget/multiselect/check/multiselect.check.pane.js +++ b/src/widget/multiselect/check/multiselect.check.pane.js @@ -26,7 +26,7 @@ BI.MultiSelectCheckPane = BI.inherit(BI.Widget, { var self = this, opts = this.options; - this.storeValue = {}; + this.storeValue = opts.value || {}; this.display = BI.createWidget({ type: "bi.display_selected_list", items: opts.items, diff --git a/src/widget/multiselect/multiselect..insert.combo.js b/src/widget/multiselect/multiselect..insert.combo.js index 9e53c1b7d..80f6dcc48 100644 --- a/src/widget/multiselect/multiselect..insert.combo.js +++ b/src/widget/multiselect/multiselect..insert.combo.js @@ -48,7 +48,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { } callback.apply(self, arguments); }); - } + }, + value: o.value }); this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { @@ -157,6 +158,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { }); } }, + value: o.value, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } diff --git a/src/widget/multiselect/multiselect.combo.js b/src/widget/multiselect/multiselect.combo.js index 8ba8d45bb..d957404d0 100644 --- a/src/widget/multiselect/multiselect.combo.js +++ b/src/widget/multiselect/multiselect.combo.js @@ -23,7 +23,10 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { self.trigger.getSearcher().setState(self.storeValue); self.trigger.getCounter().setButtonChecked(self.storeValue); }; - this.storeValue = {}; + this.storeValue = o.value || {}; + + this._assertValue(this.storeValue); + // 标记正在请求数据 this.requesting = false; @@ -48,7 +51,8 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { } callback.apply(self, arguments); }); - } + }, + value: this.storeValue }); this.trigger.on(BI.MultiSelectTrigger.EVENT_START, function () { @@ -153,6 +157,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, { }); } }, + value: o.value, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } diff --git a/src/widget/multiselect/multiselect.loader.js b/src/widget/multiselect/multiselect.loader.js index 5d152540e..ca76c6856 100644 --- a/src/widget/multiselect/multiselect.loader.js +++ b/src/widget/multiselect/multiselect.loader.js @@ -27,6 +27,9 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { var self = this, opts = this.options; var hasNext = false; + this.storeValue = opts.value || {}; + this._assertValue(this.storeValue); + this.button_group = BI.createWidget({ type: "bi.select_list", element: this, @@ -93,7 +96,8 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, { }, hasNext: function () { return hasNext; - } + }, + value: this.storeValue }); this.button_group.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); diff --git a/src/widget/multiselect/multiselect.popup.view.js b/src/widget/multiselect/multiselect.popup.view.js index b1137d1db..50f863d63 100644 --- a/src/widget/multiselect/multiselect.popup.view.js +++ b/src/widget/multiselect/multiselect.popup.view.js @@ -25,7 +25,8 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { type: "bi.multi_select_loader", itemsCreator: opts.itemsCreator, valueFormatter: opts.valueFormatter, - onLoaded: opts.onLoaded + onLoaded: opts.onLoaded, + value: opts.value }); this.popupView = BI.createWidget({ @@ -36,7 +37,8 @@ BI.MultiSelectPopupView = BI.inherit(BI.Widget, { maxHeight: opts.maxHeight, element: this, buttons: [BI.i18nText("BI-Basic_Clears"), BI.i18nText("BI-Basic_Sure")], - el: this.loader + el: this.loader, + value: opts.value }); this.popupView.on(BI.MultiPopupView.EVENT_CHANGE, function () { diff --git a/src/widget/multiselect/multiselect.trigger.js b/src/widget/multiselect/multiselect.trigger.js index 455502610..4ee7e825a 100644 --- a/src/widget/multiselect/multiselect.trigger.js +++ b/src/widget/multiselect/multiselect.trigger.js @@ -41,7 +41,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { valueFormatter: o.valueFormatter, popup: {}, adapter: o.adapter, - masker: o.masker + masker: o.masker, + value: o.value }); this.searcher.on(BI.MultiSelectSearcher.EVENT_START, function () { self.fireEvent(BI.MultiSelectTrigger.EVENT_START); @@ -63,7 +64,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, { valueFormatter: o.valueFormatter, itemsCreator: o.itemsCreator, adapter: o.adapter, - masker: o.masker + masker: o.masker, + value: o.value }); this.numberCounter.on(BI.MultiSelectCheckSelectedSwitcher.EVENT_TRIGGER_CHANGE, function () { self.fireEvent(BI.MultiSelectTrigger.EVENT_COUNTER_CLICK); diff --git a/src/widget/multiselect/search/multiselect.search.loader.js b/src/widget/multiselect/search/multiselect.search.loader.js index 5b1d919b5..1853958fb 100644 --- a/src/widget/multiselect/search/multiselect.search.loader.js +++ b/src/widget/multiselect/search/multiselect.search.loader.js @@ -20,13 +20,14 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, { var self = this, opts = this.options; var hasNext = false; - + this.storeValue = BI.deepClone(opts.value); this.button_group = BI.createWidget({ type: "bi.select_list", element: this, logic: { dynamic: false }, + value: opts.value, el: { tipText: BI.i18nText("BI-No_Select"), el: { diff --git a/src/widget/multiselect/search/multiselect.search.pane.js b/src/widget/multiselect/search/multiselect.search.pane.js index 47ea910a9..96cbdab59 100644 --- a/src/widget/multiselect/search/multiselect.search.pane.js +++ b/src/widget/multiselect/search/multiselect.search.pane.js @@ -43,7 +43,8 @@ BI.MultiSelectSearchPane = BI.inherit(BI.Widget, { callback(res); self.setKeyword(o.keywordGetter()); }]); - } + }, + value: o.value }); this.loader.on(BI.Controller.EVENT_CHANGE, function () { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); diff --git a/src/widget/multiselect/trigger/button.checkselected.js b/src/widget/multiselect/trigger/button.checkselected.js index f75840d3b..d3b485127 100644 --- a/src/widget/multiselect/trigger/button.checkselected.js +++ b/src/widget/multiselect/trigger/button.checkselected.js @@ -19,7 +19,7 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { _init: function () { BI.MultiSelectCheckSelectedButton.superclass._init.apply(this, arguments); - var self = this; + var self = this, o = this.options; this.numberCounter = BI.createWidget({ type: "bi.text_button", element: this, @@ -43,6 +43,9 @@ BI.MultiSelectCheckSelectedButton = BI.inherit(BI.Single, { self.numberCounter.setText(self.numberCounter.getTag()); }); this.setVisible(false); + if(BI.isNotNull(o.value)){ + this.setValue(o.value); + } }, setValue: function (ob) { diff --git a/src/widget/multiselect/trigger/editor.multiselect.js b/src/widget/multiselect/trigger/editor.multiselect.js index ec7f4c1e0..19932b8af 100644 --- a/src/widget/multiselect/trigger/editor.multiselect.js +++ b/src/widget/multiselect/trigger/editor.multiselect.js @@ -25,7 +25,8 @@ BI.MultiSelectEditor = BI.inherit(BI.Widget, { element: this, height: o.height, watermark: BI.i18nText("BI-Basic_Search"), - allowBlank: true + allowBlank: true, + value: o.value }); this.editor.on(BI.Controller.EVENT_CHANGE, function () { diff --git a/src/widget/multiselect/trigger/searcher.multiselect.js b/src/widget/multiselect/trigger/searcher.multiselect.js index 3a410c46e..77465b5bd 100644 --- a/src/widget/multiselect/trigger/searcher.multiselect.js +++ b/src/widget/multiselect/trigger/searcher.multiselect.js @@ -47,7 +47,8 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { op.keyword = self.editor.getValue(); this.setKeyword(op.keyword); o.itemsCreator(op, callback); - } + }, + value: o.value }, o.popup), adapter: o.adapter, @@ -72,6 +73,9 @@ BI.MultiSelectSearcher = BI.inherit(BI.Widget, { var keywords = this.getKeywords(); self.fireEvent(BI.MultiSelectSearcher.EVENT_SEARCHING, keywords); }); + if(BI.isNotNull(o.value)){ + this.setState(o.value); + } }, adjustView: function () { diff --git a/src/widget/multiselect/trigger/switcher.checkselected.js b/src/widget/multiselect/trigger/switcher.checkselected.js index 5f1ec59bf..10b89bab5 100644 --- a/src/widget/multiselect/trigger/switcher.checkselected.js +++ b/src/widget/multiselect/trigger/switcher.checkselected.js @@ -24,7 +24,8 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { this.button = BI.createWidget(o.el, { type: "bi.multi_select_check_selected_button", - itemsCreator: o.itemsCreator + itemsCreator: o.itemsCreator, + value: o.value }); this.button.on(BI.Events.VIEW, function () { self.fireEvent(BI.Events.VIEW, arguments); @@ -40,7 +41,8 @@ BI.MultiSelectCheckSelectedSwitcher = BI.inherit(BI.Widget, { itemsCreator: o.itemsCreator, onClickContinueSelect: function () { self.switcher.hideView(); - } + }, + value: o.value }, o.popup), adapter: o.adapter, masker: o.masker diff --git a/src/widget/multitree/check/multi.tree.check.pane.js b/src/widget/multitree/check/multi.tree.check.pane.js index 57efc414c..b33b77daf 100644 --- a/src/widget/multitree/check/multi.tree.check.pane.js +++ b/src/widget/multitree/check/multi.tree.check.pane.js @@ -62,7 +62,8 @@ BI.MultiTreeCheckPane = BI.inherit(BI.Pane, { itemsCreator: function (op, callback) { op.type = BI.TreeView.REQ_TYPE_GET_SELECTED_DATA; opts.itemsCreator(op, callback); - } + }, + value: (opts.value || {}).value }); this.display.on(BI.Events.AFTERINIT, function () { diff --git a/src/widget/multitree/multi.tree.combo.js b/src/widget/multitree/multi.tree.combo.js index 35befb8c7..30b07499d 100644 --- a/src/widget/multitree/multi.tree.combo.js +++ b/src/widget/multitree/multi.tree.combo.js @@ -31,6 +31,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { var isInit = false; var want2showCounter = false; + this.storeValue = {value: o.value || {}}; + this.trigger = BI.createWidget({ type: "bi.multi_select_trigger", height: o.height, @@ -50,7 +52,8 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { type: "bi.multi_tree_check_pane", itemsCreator: o.itemsCreator } - } + }, + value: {value: o.value || {}} }); @@ -106,12 +109,12 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, { }); } }, + value: {value: o.value || {}}, hideChecker: function (e) { return triggerBtn.element.find(e.target).length === 0; } }); - - this.storeValue = {value: {}}; + var change = false; var clear = false; // 标识当前是否点击了清空 diff --git a/src/widget/multitree/multi.tree.popup.js b/src/widget/multitree/multi.tree.popup.js index 2ba7d906a..7a38c7beb 100644 --- a/src/widget/multitree/multi.tree.popup.js +++ b/src/widget/multitree/multi.tree.popup.js @@ -27,7 +27,8 @@ BI.MultiTreePopup = BI.inherit(BI.Pane, { height: 400, cls: "popup-view-tree", itemsCreator: opts.itemsCreator, - onLoaded: opts.onLoaded + onLoaded: opts.onLoaded, + value: opts.value || {} }); this.popupView = BI.createWidget({ diff --git a/src/widget/multitree/multi.tree.search.pane.js b/src/widget/multitree/multi.tree.search.pane.js index b02dcb94a..bdc0d7626 100644 --- a/src/widget/multitree/multi.tree.search.pane.js +++ b/src/widget/multitree/multi.tree.search.pane.js @@ -27,7 +27,8 @@ BI.MultiTreeSearchPane = BI.inherit(BI.Pane, { itemsCreator: function (op, callback) { op.keyword = opts.keywordGetter(); opts.itemsCreator(op, callback); - } + }, + value: opts.value }); this.partTree.on(BI.Controller.EVENT_CHANGE, function () { diff --git a/src/widget/multitree/trigger/searcher.multi.tree.js b/src/widget/multitree/trigger/searcher.multi.tree.js index f17c38c8c..12db605f2 100644 --- a/src/widget/multitree/trigger/searcher.multi.tree.js +++ b/src/widget/multitree/trigger/searcher.multi.tree.js @@ -49,7 +49,8 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { itemsCreator: function (op, callback) { op.keyword = self.editor.getValue(); o.itemsCreator(op, callback); - } + }, + value: o.value }, o.popup), adapter: o.adapter, @@ -70,6 +71,9 @@ BI.MultiTreeSearcher = BI.inherit(BI.Widget, { this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { self.fireEvent(BI.MultiTreeSearcher.EVENT_CHANGE, arguments); }); + if (BI.isNotNull(o.value)) { + this.setState(o.value); + } }, adjustView: function () {