diff --git a/changelog.md b/changelog.md index 171704388c..fe1e30a8ab 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-04) +- 复选下拉框新增值的时候外抛事件 - 空格不再编码成  - 支持文本区域水印可滚动 diff --git a/src/widget/multiselect/multiselect.insert.combo.js b/src/widget/multiselect/multiselect.insert.combo.js index 457c4fadf4..7fdc71c35f 100644 --- a/src/widget/multiselect/multiselect.insert.combo.js +++ b/src/widget/multiselect/multiselect.insert.combo.js @@ -74,7 +74,9 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () { if (!this.getSearcher().hasMatched()) { self._addItem(assertShowValue); + var addedValue = this.getSearcher().getKeyword(); self._stopEditing(); + self.fireEvent(BI.MultiSelectInsertCombo.EVENT_ADD_ITEM, addedValue); } }); this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) { @@ -456,5 +458,6 @@ BI.MultiSelectInsertCombo.EVENT_STOP = "EVENT_STOP"; BI.MultiSelectInsertCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; BI.MultiSelectInsertCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; BI.MultiSelectInsertCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.MultiSelectInsertCombo.EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; BI.shortcut("bi.multi_select_insert_combo", BI.MultiSelectInsertCombo); \ No newline at end of file diff --git a/src/widget/multiselect/multiselect.insert.combo.nobar.js b/src/widget/multiselect/multiselect.insert.combo.nobar.js index 0e39286b18..cb7ac6c125 100644 --- a/src/widget/multiselect/multiselect.insert.combo.nobar.js +++ b/src/widget/multiselect/multiselect.insert.combo.nobar.js @@ -69,7 +69,9 @@ BI.MultiSelectInsertNoBarCombo = BI.inherit(BI.Single, { this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_ADD_ITEM, function () { if (!this.getSearcher().hasMatched()) { self._addItem(assertShowValue); + var addedValue = this.getSearcher().getKeyword(); self._stopEditing(); + self.fireEvent(BI.MultiSelectInsertNoBarCombo.EVENT_ADD_ITEM, addedValue); } }); this.trigger.on(BI.MultiSelectInsertTrigger.EVENT_SEARCHING, function (keywords) { @@ -448,5 +450,6 @@ BI.extend(BI.MultiSelectInsertNoBarCombo, { }); BI.MultiSelectInsertNoBarCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; +BI.MultiSelectInsertNoBarCombo.EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; BI.shortcut("bi.multi_select_insert_no_bar_combo", BI.MultiSelectInsertNoBarCombo); \ No newline at end of file