Browse Source

allow skipping or custom search

NAME 6 years ago
parent
commit
439fbd998c

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

@@ -224,6 +224,9 @@ Dependence if you use the datepicker option: [bootstrap-datepicker](https://gith
      * `field`: the column field name.
      * `data`: the table data.
 
+   Return `false` to filter out the column/row.  
+   Return `null` to skip the custom search for the current value.
+
 - **Default:** `undefined`
 
 ### Icons

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

@@ -770,7 +770,10 @@ $.BootstrapTable = class extends $.BootstrapTable {
                 }
 
                 if (thisColumn.filterCustomSearch) {
-                  tmpItemIsExpected = Utils.calculateObjectValue(that, thisColumn.filterCustomSearch, [fval, value, key, that.options.data], true)
+                  const customSearchResult = Utils.calculateObjectValue(that, thisColumn.filterCustomSearch, [fval, value, key, that.options.data], true)
+                  if (customSearchResult !== null) {
+                    tmpItemIsExpected = customSearchResult
+                  }
                 }
               }
             }