Browse Source

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 years ago
parent
commit
f53b781346
1 changed files with 5 additions and 3 deletions
  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) {