ソースを参照

Added filterLocal option

This option allows to enable (default) or disable
the js filter for the table. You can set it to false
if you want to filter your data on server side
Maxime Mérian 10 年 前
コミット
8b71f4032d

+ 6 - 1
src/extensions/filter-control/README.md

@@ -23,6 +23,11 @@ Dependence if you use the datepicker option: [bootstrap-datepicker](https://gith
 * description: Set true to add a button to clear all the controls added by this plugin
 * description: Set true to add a button to clear all the controls added by this plugin
 * default: `false`
 * default: `false`
 
 
+### filterLocal
+
+* type: Boolean
+* description: Set false to disable local data filtering. This allows you to filter the data on server side when using remote data sources.
+* default: `true`
 
 
 ## Column options
 ## Column options
 
 
@@ -49,4 +54,4 @@ Dependence if you use the datepicker option: [bootstrap-datepicker](https://gith
 
 
 ### onColumnSearch(column-search.bs.table)
 ### onColumnSearch(column-search.bs.table)
 
 
-* Fired when we are searching into the column data
+* Fired when we are searching into the column data

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

@@ -246,7 +246,8 @@
         filterControl: undefined,
         filterControl: undefined,
         filterData: undefined,
         filterData: undefined,
         filterDatepickerOptions: undefined,
         filterDatepickerOptions: undefined,
-        filterStrictSearch: false
+        filterStrictSearch: false,
+        filterLocal: true
     });
     });
 
 
     $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
     $.extend($.fn.bootstrapTable.Constructor.EVENTS, {
@@ -364,6 +365,10 @@
     BootstrapTable.prototype.initSearch = function () {
     BootstrapTable.prototype.initSearch = function () {
         _initSearch.apply(this, Array.prototype.slice.apply(arguments));
         _initSearch.apply(this, Array.prototype.slice.apply(arguments));
 
 
+        if (! this.options.filterLocal) {
+            return;
+        }
+
         var that = this;
         var that = this;
         var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;
         var fp = $.isEmptyObject(this.filterColumnsPartial) ? null : this.filterColumnsPartial;