Browse Source

Add support for filter control starts with search

Alec Fenichel 10 years ago
parent
commit
0ffd364846
1 changed files with 9 additions and 1 deletions
  1. 9 1
      src/extensions/filter-control/bootstrap-table-filter-control.js

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

@@ -325,7 +325,8 @@
         filterControl: undefined,
         filterData: undefined,
         filterDatepickerOptions: undefined,
-        filterStrictSearch: false
+        filterStrictSearch: false,
+        filterStartsWithSearch: false
     });
 
     $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
@@ -452,6 +453,13 @@
                         return false;
                     }
                 }
+                else if(thisColumn.filterStartsWithSearch){
+                  if (!($.inArray(key, that.header.fields) !== -1 &&
+                      (typeof value === 'string' || typeof value === 'number') &&
+                      (value + '').toLowerCase().indexOf(fval) == 0)) {
+                      return false;
+                  }
+                }
                 else {
                     if (!($.inArray(key, that.header.fields) !== -1 &&
                         (typeof value === 'string' || typeof value === 'number') &&