diff --git a/changelog.md b/changelog.md index 384758d89..02c590507 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2019-12) +- bi.search_editor支持搜索中间含有空格的字符串 - 修复了监听日期下拉框before_popup_view事件,调用setMinDate无效的问题 - 修复了数值滑块逆向排列滑块后populate显示效果不对的问题 - 不影响父节点勾选状态的复选树支持自定义水印和默认值 diff --git a/src/base/combination/searcher.js b/src/base/combination/searcher.js index 07423dc24..2daad7077 100644 --- a/src/base/combination/searcher.js +++ b/src/base/combination/searcher.js @@ -164,7 +164,7 @@ BI.Searcher = BI.inherit(BI.Widget, { }, _search: function () { - var self = this, o = this.options, keyword = this.editor.getValue(); + var self = this, o = this.options, keyword = this.getLastSearchKeyword(); if (keyword === "" || this._stop) { return; } @@ -197,6 +197,13 @@ BI.Searcher = BI.inherit(BI.Widget, { }); }, + getLastSearchKeyword: function () { + if (this.isValid()) { + var res = this.editor.getValue().match(/[\S]+/g); + return BI.isNull(res) ? "" : res[res.length - 1]; + } + }, + setAdapter: function (adapter) { this.options.adapter = adapter; BI.Maskers.remove(this.getName()); @@ -258,7 +265,7 @@ BI.Searcher = BI.inherit(BI.Widget, { }, getKeyword: function () { - return this.editor.getValue(); + return this.getLastSearchKeyword(); }, getKeywords: function () { diff --git a/src/widget/editor/editor.search.js b/src/widget/editor/editor.search.js index f6079b67c..8eef89f2f 100644 --- a/src/widget/editor/editor.search.js +++ b/src/widget/editor/editor.search.js @@ -149,8 +149,7 @@ BI.SearchEditor = BI.inherit(BI.Widget, { getValue: function () { if (this.isValid()) { - var res = this.editor.getValue().match(/[\S]+/g); - return BI.isNull(res) ? "" : res[res.length - 1]; + return this.editor.getValue(); } },