浏览代码

Trim search input.

zhixin 11 年之前
父节点
当前提交
66fca4cea2
共有 2 个文件被更改,包括 4 次插入1 次删除
  1. 1 1
      README.md
  2. 3 0
      src/bootstrap-table.js

+ 1 - 1
README.md

@@ -23,7 +23,7 @@ Bootstrap table displays data in a tabular format and offers rich support to rad
 - [x] Fix #138: IE8 search data and remove method error.
 - [x] Fix bug: sorter does not work in some case.
 - [x] Add `bootstrap-table-nl-NL.js` and `bootstrap-table-el-GR.js`.
-- [x] Support search without data-field set.
+- [x] Support search without data-field set, trim search input.
 - [x] Fix #81: Allow the `class` to be applied to the radio or checkbox row.
 - [x] Fix #135, #142: Search use formatted data.
 - [x] Verify search text before send queryParams.

+ 3 - 0
src/bootstrap-table.js

@@ -570,6 +570,9 @@
     BootstrapTable.prototype.onSearch = function (event) {
         var text = $.trim($(event.currentTarget).val());
 
+        // trim search input
+        $(event.currentTarget).val(text);
+
         if (text === this.searchText) {
             return;
         }