浏览代码

Merge pull request #7352 from wenzhixin/feature/7260

feature/7260
文翼 1 年之前
父节点
当前提交
78b39f389d

+ 15 - 3
site/docs/extensions/filter-control.md

@@ -105,6 +105,18 @@ toc: true
 
 - **Default:** `,`
 
+### filterControlSearchClear
+
+- **Attribute:** `data-filter-control-search-clear`
+
+- **type:** `bool`
+
+- **Detail:**
+
+  Set to `true` to clear the filter control filters using the table option [showSearchButton](/docs/api/table-options/#showsearchbutton).
+
+- **Default:** `true`
+
 ### searchOnEnterKey
 
 - **Attribute:** `data-search-on-enter-key`
@@ -113,7 +125,7 @@ toc: true
 
 - **Detail:**
 
-  Set to true to fire the search action when the user presses the enter key.
+  Set to `true` to fire the search action when the user presses the enter key.
 
 - **Default:** `false`
 
@@ -249,7 +261,7 @@ toc: true
 
 - **Detail:**
 
-  Set to true if you want to use the starts with search mode.
+  Set to `true` if you want to use the starts with search mode.
 
 - **Default:** `false`
 
@@ -261,7 +273,7 @@ toc: true
 
 - **Detail:**
 
-  Set to true if you want to use the strict search mode.
+  Set to `true` if you want to use the strict search mode.
 
 - **Default:** `false`
 

+ 2 - 1
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -11,6 +11,7 @@ Object.assign($.fn.bootstrapTable.defaults, {
   filterControlVisible: true,
   filterControlMultipleSearch: false,
   filterControlMultipleSearchDelimiter: ',',
+  filterControlSearchClear: true,
   // eslint-disable-next-line no-unused-vars
   onColumnSearch (field, text) {
     return false
@@ -399,7 +400,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
   }
 
   resetSearch (text) {
-    if (this.options.filterControl && this.options.showSearchClearButton) {
+    if (this.options.filterControl && this.options.filterControlSearchClear && this.options.showSearchClearButton) {
       this.clearFilterControl()
     }
     super.resetSearch(text)