浏览代码

only set the search text if it was triggered by the original search (#4417)

input to prevent overwriting the search text (e.g. for the
filter-control extension)
Dustin Utecht 6 年之前
父节点
当前提交
f53b781346
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/bootstrap-table.js

+ 5 - 3
src/bootstrap-table.js

@@ -631,7 +631,7 @@ class BootstrapTable {
         </div>
       `,
       Utils.sprintf(this.constants.html.inputGroup,
-        `<input class="${this.constants.classes.input}${Utils.sprintf(' input-%s', o.iconSize)}" type="text" placeholder="${o.formatSearch()}">`,
+        `<input class="${this.constants.classes.input}${Utils.sprintf(' input-%s', o.iconSize)} search-input" type="text" placeholder="${o.formatSearch()}">`,
         (o.showSearchButton ? showSearchButton : '') +
         (o.showSearchClearButton ? showSearchClearButton : ''))
       ))
@@ -685,8 +685,10 @@ class BootstrapTable {
         return
       }
 
-      this.searchText = text
-      this.options.searchText = text
+      if ($(currentTarget).hasClass('search-input')) {
+        this.searchText = text
+        this.options.searchText = text
+      }
     }
 
     if (!firedByInitSearchText) {