浏览代码

Merge branch 'develop' into feature/group-by_merge

djhvscf 6 年之前
父节点
当前提交
a141518ce0

+ 2 - 2
.github/ISSUE_TEMPLATE.md

@@ -9,9 +9,9 @@ This is the first step
 This is the second step
 Further steps, etc.
 
-[jsfiddle]() - a link to the reduced test case([fiddle template](https://github.com/wenzhixin/bootstrap-table/issues/1765)).
+Please provide an [Online Example](https://live.bootstrap-table.com) to show your problem, thanks!
 
 Any other information you want to share that is relevant to the issue being reported. This might include the lines of code that you have identified as causing the bug, and potential solutions (and your opinions on their merits).
 
 <!-- Love bootstrap-table? Please consider supporting our collective:
-👉  https://opencollective.com/bootstrap-table/donate -->
+👉  https://opencollective.com/bootstrap-table/donate -->

+ 9 - 11
CONTRIBUTING.md

@@ -29,10 +29,11 @@ restrictions:
 * Please **do not** open issues or pull requests regarding the code in [`bootstrap-table-examples`](https://github.com/wenzhixin/bootstrap-table-examples) and [`extensions plugin dependence`](https://github.com/wenzhixin/bootstrap-table/tree/develop/src/extensions) (open them in their respective repositories), the dependence list:
     * Table Editable: [x-editable](https://github.com/vitalets/x-editable)
     * Table Export: [tableExport.jquery.plugin](https://github.com/hhurz/tableExport.jquery.plugin)
-    * Table Filter: [bootstrap-table-filter](https://github.com/lukaskral/bootstrap-table-filter)
-    * Table flat-json: [bootstrap-table-flat-json](https://github.com/djhvscf/bootstrap-table-flatJSON)
-    * Table Reorder: [jquery-ui](https://code.jquery.com/ui/) and [dragTable](https://github.com/akottr/dragtable/)
-    * Table Resizable: [colResizable](https://github.com/alvaro-prieto/colResizable)
+    * Table Reorder-Columns: [jquery-ui](https://code.jquery.com/ui/) and [dragTable](https://github.com/akottr/dragtable/)
+    * Table Reorder-Rows: [tablednd](https://github.com/isocra/TableDnD)
+    * Table Resizable: [jquery-resizable-columns](https://github.com/dobtco/jquery-resizable-columns)
+    * Table Treegrid: Dependence: [jquery-treegrid](https://github.com/maxazan/jquery-treegrid) v0.3.0
+
 
 ## Issues and labels
 
@@ -59,10 +60,7 @@ Guidelines for bug reports:
    latest `master` or development branch in the repository.
 
 3. **Isolate the problem** &mdash; ideally create a live example.
-    The web tool [jsfiddle](http://jsfiddle.net/) is a very helpful for this. Consider to use these templates:
-    * [Table from html](http://jsfiddle.net/wenyi/e3nk137y/44345/)
-    * [Table from data](http://jsfiddle.net/wenyi/e3nk137y/44346/)
-    * [Table from url](http://jsfiddle.net/wenyi/e3nk137y/44348/)
+    Our [Online Editor](https://live.bootstrap-table.com) tool is a very helpful for this.
 
 
 A good bug report shouldn't leave others needing to chase you up for more
@@ -119,7 +117,7 @@ source files in [`/src/`](https://github.com/wenzhixin/bootstrap-table/tree/deve
 
 Similarly, when contributing to Bootstrap's documentation, you should edit the
 documentation source files in
-[the `/docs/` directory of the `develop` branch](https://github.com/wenzhixin/bootstrap-table/tree/develop/docs).
+[the `/site/` directory of the `develop` branch](https://github.com/wenzhixin/bootstrap-table/tree/develop/site).
 
 Adhering to the following process is the best way to get your work
 included in the project:
@@ -174,7 +172,7 @@ included in the project:
 **IMPORTANT**: By submitting a patch, you agree to allow the project owners to
 license your work under the terms of the [MIT License](LICENSE) (if it
 includes code changes) and under the terms of the
-[Creative Commons Attribution 3.0 Unported License](docs/LICENSE)
+[Creative Commons Attribution 3.0 Unported License](site/LICENSE)
 (if it includes documentation changes).
 
 
@@ -189,7 +187,7 @@ includes code changes) and under the terms of the
 ## License
 
 By contributing your code, you agree to license your contribution under the [MIT License](LICENSE).
-By contributing to the documentation, you agree to license your contribution under the [Creative Commons Attribution 3.0 Unported License](docs/LICENSE).
+By contributing to the documentation, you agree to license your contribution under the [Creative Commons Attribution 3.0 Unported License](site/LICENSE).
 
 
 ## Financial contributions

+ 1 - 1
FUNDING.yml

@@ -1,6 +1,6 @@
 # These are supported funding model platforms
 
-github: wenzhixin
+github: # wenzhixin
 patreon: # Replace with a single Patreon username
 open_collective: bootstrap-table
 ko_fi: # Replace with a single Ko-fi username

+ 3 - 3
README.md

@@ -78,13 +78,13 @@ For feature requests, bug reports or submitting pull requests, please ensure you
 
 As stated above, please read [CONTRIBUTING.md](https://github.com/wenzhixin/bootstrap-table/blob/master/CONTRIBUTING.md), especially [Bug Reports](https://github.com/wenzhixin/bootstrap-table/blob/master/CONTRIBUTING.md#bug-reports)
 
-And as stated there, please provide jsFiddle when creating issues!
+And as stated there, please provide an [Online Example](https://live.bootstrap-table.com) when creating issues!
 
 It's really saves much time.
 
-You can also use these for templates:
+You can also use our examples template via Load Examples button:
 
-[jsFiddle Bootstrap Table](https://github.com/wenzhixin/bootstrap-table/issues/1765)
+[Online Editor](https://live.bootstrap-table.com/)
 
 Your feedback is very appreciated!
 

+ 0 - 1
site/_data/nav.yml

@@ -42,7 +42,6 @@
     - title: Reorder Columns
     - title: Reorder Rows
     - title: Resizable
-    - title: Select2 Filter
     - title: Sticky Header
     - title: Toolbar
     - title: Treegrid

+ 8 - 1
site/_includes/docs-navbar.html

@@ -18,7 +18,6 @@
       <li class="nav-item {% if page.group == "themes" %}active{% endif %}">
         <a class="nav-link" href="{{ site.baseurl }}/themes">
           CSS Frameworks
-          <span class="badge badge-warning">New</span>
         </a>
       </li>
       <li class="nav-item">
@@ -27,6 +26,14 @@
           Examples
         </a>
       </li>
+      <li class="nav-item">
+        <a class="nav-link"
+          href="https://live.bootstrap-table.com"
+          target="_blank">
+          Online Editor
+          <span class="badge badge-warning">New</span>
+        </a>
+      </li>
       <li class="nav-item {% if page.title == "Donate" %}active{% endif %}">
         <a class="nav-link" href="{{ site.baseurl }}/donate">
           Donate

+ 2 - 0
site/docs/api/methods.md

@@ -137,6 +137,7 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
   * `index`: the row index to be updated.
   * `row`: the new row data.
+  * `replace` (optional): set to `true` to replace the row instead of extending.
 
 - **Example:** [Update Row](https://examples.bootstrap-table.com/#methods/update-row.html)
 
@@ -160,6 +161,7 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
   * `id`: a row id where the id should be the uniqueid field assigned to the table.
   * `row`: the new row data.
+  * `replace` (optional): set to `true` to replace the row instead of extending.
 
 - **Example:** [Update By Unique Id](https://examples.bootstrap-table.com/#methods/update-by-unique-id.html)
 

+ 22 - 0
site/docs/extensions/export.md

@@ -56,8 +56,30 @@ This is an important link to check out as some file types may require extra step
 
    export [options](https://github.com/hhurz/tableExport.jquery.plugin#options) of `tableExport.jquery.plugin`
 
+   `exportOptions.fileName` can be a string or a function, for example:
+
+   ```js
+   exportOptions: {
+      fileName: function () {
+         return 'exportName'
+      }
+   }
+   ```
+
 - **Default:** `{}`
 
+## Column options
+
+### forceExport
+
+- **type:** `Boolean`
+
+- **Detail:**
+
+   Set `true` to force export a column e.g. hidden columns.
+
+- **Default:** `false`
+
 ## Events
 
 ### onExportSaved

+ 2 - 2
site/docs/extensions/i18n-enhance.md

@@ -6,12 +6,12 @@ group: extensions
 toc: true
 ---
 
-Use Plugin: [bootstrap-table-i18n-enhance](https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/select2-filter)
+Use Plugin: [bootstrap-table-i18n-enhance](https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/i18n-enhance)
 
 ## Usage
 
 {% highlight html %}
-<script src="extensions/select2-filter/bootstrap-table-i18n-enhance.js"></script>
+<script src="extensions/i18n-enhance/bootstrap-table-i18n-enhance.js"></script>
 {% endhighlight %}
 
 ## Methods

+ 0 - 86
site/docs/extensions/select2-filter.md

@@ -1,86 +0,0 @@
----
-layout: docs
-title: Table Select2 Filter
-description: Table Select2 Filter extension of Bootstrap Table.
-group: extensions
-toc: true
----
-
-Use Plugin: [bootstrap-table-select2-filter](https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/select2-filter) </br>
-Dependence if you use the select2 option: [Select2](https://select2.github.io/) v4.0.0 upper
-
-## Usage
-
-{% highlight html %}
-<script src="extensions/select2-filter/bootstrap-table-select2-filter.js"></script>
-{% endhighlight %}
-
-## Options
-
-### filter
-
-- **type:** `Boolean`
-
-- **Detail:**
-
-   enabled select2 filter exetension.
-
-- **Default:** `false`
-
-### filterValues
-
-- **type:** `Object`
-
-- **Detail:**
-
-   Set default selected value. <br>Example: <code>{columnA.field.:'Column A Selected Value',columnB.field:'Column B Selected Value'}</code>
-
-- **Default:** `undefined`
-
-### filterTemplate
-- **type:** `Object`
-
-- **Detail:**
-
-   customize default filter template. <br>Example: <code> {
-&nbsp;&nbsp;input: function (bootstrapTable, column, isVisible) {
-&nbsp;&nbsp;return `'<input type="text" class="form-control input-sm" data-filter-field="' + column.field + '" style="width: 100%; visibility:' + isVisible + '">'`;
-          }
-</code>
-
-## Column options
-
-### filter
-
-- **type:** `Object`
-
-- **Detail:**
-
-   Set filter option to configure the filter. <br>Example: {type:'select', data:["itemA", "itemB", "itemC"]}
-	* type: default support adding `input` or `select` into the column.
-	* data: need to set when type is `select` , filter data list. (The same as [Select2 Options](http://select2.github.io/examples.html#data))
-
-- **Default:** `undefined`
-* customize filter: <code>  filter: {
-&nbsp;template: // HTML String or jQuery Object,
-&nbsp;setFilterValue: function ($filter, field, value) { <br>&nbsp;&nbsp;&nbsp;&nbsp;// set template default value.
-&nbsp;}
-            }
-</code>
-
-## Methods
-
-### setSelect2Data
-
-
-* Set column's filter data.
-  * Parameters
-      * String : column field.
-      * Object : filter data list.
-  * Example: <code> $table.bootstrapTable("setSelect2Data", "columnA.filed", ["itemA", "itemB", "itemC"]);</code>
-
-
-### setFilterValues
-  * Parameters
-      * Object : column field / default value.
-  * Example: <code> $table.bootstrapTable("setFilterValues",  {columnA.field.:'Column A Selected Value',columnB.field:'Column B Selected Value'});</code>

+ 2 - 1
site/docs/extensions/treegrid.md

@@ -6,7 +6,8 @@ group: extensions
 toc: true
 ---
 
-Use Plugin: [bootstrap-table-treegrid](https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/treegrid)
+Use Plugin: [bootstrap-table-treegrid](https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/treegrid)</br>
+Dependence: [jquery-treegrid](https://github.com/maxazan/jquery-treegrid) v0.3.0
 
 ## Usage
 

+ 1 - 1
site/docs/faq.md

@@ -48,7 +48,7 @@ $('#eventsTable').on('click-row.bs.table', function (event, row, $element) {
 })
 ```
 
-the first parameter is always `event`: [http://jsfiddle.net/wenyi/e3nk137y/11688/](http://jsfiddle.net/wenyi/e3nk137y/11688/)
+the first parameter is always `event`: [https://live.bootstrap-table.com/code/wenzhixin/46](https://live.bootstrap-table.com/code/wenzhixin/46)
 
 and use onClickRow event:
 

+ 19 - 7
src/bootstrap-table.js

@@ -627,11 +627,11 @@ class BootstrapTable {
 
       html.push(Utils.sprintf(`
         <div class="${this.constants.classes.pull}-${o.searchAlign} search ${this.constants.classes.inputGroup}">
-            %s
+          %s
         </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) {
@@ -1025,7 +1027,7 @@ class BootstrapTable {
               html.push(pageItem(i, ' page-intermediate'))
             } else {
               html.push(Utils.sprintf(this.constants.html.paginationItem,
-                ' page-last-separator disabled', '...'))
+                ' page-last-separator disabled', '', '...'))
             }
           }
         }
@@ -2061,7 +2063,13 @@ class BootstrapTable {
       if (!params.hasOwnProperty('index') || !params.hasOwnProperty('row')) {
         continue
       }
+
       $.extend(this.options.data[params.index], params.row)
+      if (params.hasOwnProperty('replace') && params.replace) {
+        this.options.data[params.index] = params.row
+      } else {
+        $.extend(this.options.data[params.index], params.row)
+      }
     }
 
     this.initSearch()
@@ -2118,11 +2126,15 @@ class BootstrapTable {
       }
 
       const rowId = this.options.data.indexOf(this.getRowByUniqueId(params.id))
-
       if (rowId === -1) {
         continue
       }
-      $.extend(this.options.data[rowId], params.row)
+
+      if (params.hasOwnProperty('replace') && params.replace) {
+        this.options.data[rowId] = params.row
+      } else {
+        $.extend(this.options.data[rowId], params.row)
+      }
     }
 
     this.initSearch()

+ 23 - 2
src/extensions/export/bootstrap-table-export.js

@@ -35,6 +35,10 @@ $.extend($.fn.bootstrapTable.defaults, {
   exportFooter: false
 })
 
+$.extend($.fn.bootstrapTable.columnDefaults, {
+  forceExport: false
+})
+
 $.extend($.fn.bootstrapTable.defaults.icons, {
   export: {
     bootstrap3: 'glyphicon-export icon-share',
@@ -89,8 +93,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
       data-toggle="dropdown"
       type="button"
       title="${o.formatExport()}">
-      ${ o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.export) : ''}
-      ${ o.showButtonText ? o.formatExport() : ''}
+      ${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.export) : ''}
+      ${o.showButtonText ? o.formatExport() : ''}
       ${this.constants.html.dropdownCaret}
       </button>
       </div>
@@ -183,6 +187,17 @@ $.BootstrapTable = class extends $.BootstrapTable {
         })
       }
 
+      const hiddenColumns = this.getHiddenColumns()
+      hiddenColumns.forEach((row) => {
+        if (row.forceExport) {
+          this.showColumn(row.field)
+        }
+      })
+
+      if (typeof o.exportOptions.fileName === 'function') {
+        options.fileName = o.exportOptions.fileName()
+      }
+
       this.$el.tableExport($.extend({
         onAfterSaveToFile: () => {
           if (o.exportFooter) {
@@ -196,6 +211,12 @@ $.BootstrapTable = class extends $.BootstrapTable {
             this.toggleView()
           }
 
+          hiddenColumns.forEach((row) => {
+            if (row.forceExport) {
+              this.hideColumn(row.field)
+            }
+          })
+
           if (callback) callback()
         }
       }, o.exportOptions, options))

+ 4 - 0
src/extensions/multiple-sort/bootstrap-table-multiple-sort.js

@@ -497,6 +497,10 @@ BootstrapTable.prototype.initToolbar = function (...args) {
   this.$sortModal = $(sortModalId)
   this.sortModalSelector = sortModalSelector
 
+  if (that.options.sortPriority !== null) {
+    that.onMultipleSort()
+  }
+
   _initToolbar.apply(this, Array.prototype.slice.apply(args))
 
   if (that.options.sidePagination === 'server' && !isSingleSort && that.options.sortPriority !== null) {

+ 0 - 335
src/extensions/select2-filter/bootstrap-table-select2-filter.js

@@ -1,335 +0,0 @@
-/**
- * @author: Jewway
- * @version: v1.1.1
- */
-
-function getCurrentHeader (that) {
-  let header = that.$header
-  if (that.options.height) {
-    header = that.$tableHeader
-  }
-
-  return header
-}
-
-function initFilterValues (that) {
-  if (!$.isEmptyObject(that.filterColumnsPartial)) {
-    const $header = getCurrentHeader(that)
-
-    $.each(that.columns, (idx, column) => {
-      const value = that.filterColumnsPartial[column.field]
-
-      if (column.filter) {
-        if (column.filter.setFilterValue) {
-          const $filter = $header.find(`[data-field=${column.field}] .filter`)
-          column.filter.setFilterValue($filter, column.field, value)
-        } else {
-          const $ele = $header.find(`[data-filter-field=${column.field}]`)
-          switch (column.filter.type) {
-            case 'input':
-              $ele.val(value)
-              break
-            case 'select':
-              $ele.val(value).trigger('change')
-              break
-            default:
-              break
-          }
-        }
-      }
-    })
-  }
-}
-
-function createFilter (that, header) {
-  let enableFilter = false
-  let isVisible
-  let html
-  let timeoutId = 0
-
-  $.each(that.columns, (i, column) => {
-    isVisible = 'hidden'
-    html = null
-
-    if (!column.visible) {
-      return
-    }
-
-    if (!column.filter) {
-      html = $('<div class="no-filter"></div>')
-    } else {
-      const filterClass = column.filter.class ? ` ${column.filter.class}` : ''
-      html = $(`<div style="margin: 0px 2px 2px 2px;" class="filter${filterClass}">`)
-
-      if (column.searchable) {
-        enableFilter = true
-        isVisible = 'visible'
-      }
-
-      if (column.filter.template) {
-        html.append(column.filter.template(that, column, isVisible))
-      } else {
-        const $filter = $(that.options.filterTemplate[column.filter.type.toLowerCase()](that, column, isVisible))
-
-        switch (column.filter.type) {
-          case 'input':
-            let cpLock = true
-            $filter.off('compositionstart').on('compositionstart', event => {
-              cpLock = false
-            })
-
-            $filter.off('compositionend').on('compositionend', function (event) {
-              cpLock = true
-              const $input = $(this)
-              clearTimeout(timeoutId)
-              timeoutId = setTimeout(() => {
-                that.onColumnSearch(event, column.field, $input.val())
-              }, that.options.searchTimeOut)
-            })
-
-            $filter.off('keyup').on('keyup', function (event) {
-              if (cpLock) {
-                const $input = $(this)
-                clearTimeout(timeoutId)
-                timeoutId = setTimeout(() => {
-                  that.onColumnSearch(event, column.field, $input.val())
-                }, that.options.searchTimeOut)
-              }
-            })
-
-            $filter.off('mouseup').on('mouseup', function (event) {
-              const $input = $(this)
-              const oldValue = $input.val()
-
-              if (oldValue === '') {
-                return
-              }
-
-              setTimeout(() => {
-                const newValue = $input.val()
-
-                if (newValue === '') {
-                  clearTimeout(timeoutId)
-                  timeoutId = setTimeout(() => {
-                    that.onColumnSearch(event, column.field, newValue)
-                  }, that.options.searchTimeOut)
-                }
-              }, 1)
-            })
-            break
-          case 'select':
-            $filter.on('select2:select', function (event) {
-              that.onColumnSearch(event, column.field, $(this).val())
-            })
-
-            $filter.on('select2:unselecting', function (event) {
-              const $select2 = $(this)
-              event.preventDefault()
-              $select2.val(null).trigger('change')
-              that.searchText = undefined
-              that.onColumnSearch(event, column.field, $select2.val())
-            })
-            break
-          default:
-            break
-        }
-
-        html.append($filter)
-      }
-    }
-
-    $.each(header.children().children(), (i, tr) => {
-      tr = $(tr)
-      if (tr.data('field') === column.field) {
-        tr.find('.fht-cell').append(html)
-        return false
-      }
-    })
-  })
-
-  if (!enableFilter) {
-    header.find('.filter').hide()
-  }
-}
-
-function initSelect2 (that) {
-  const $header = getCurrentHeader(that)
-
-  $.each(that.columns, (idx, column) => {
-    if (column.filter && column.filter.type === 'select') {
-      const $selectEle = $header.find(`select[data-filter-field="${column.field}"]`)
-
-      if ($selectEle.length > 0 && !$selectEle.data().select2) {
-        const select2Opts = {
-          placeholder: '',
-          allowClear: true,
-          data: column.filter.data,
-          dropdownParent: that.$el.closest('.bootstrap-table')
-        }
-
-        $selectEle.select2(select2Opts)
-      }
-    }
-  })
-}
-
-$.extend($.fn.bootstrapTable.defaults, {
-  filter: false,
-  filterValues: {},
-  filterTemplate: {
-    input (instance, column, isVisible) {
-      return `<input type="text" class="form-control" data-filter-field="${column.field}" style="width: 100%; visibility:${isVisible}">`
-    },
-    select (instance, column, isVisible) {
-      return `<select data-filter-field="${column.field}" style="width: 100%; visibility:${isVisible}"></select>`
-    }
-  },
-  onColumnSearch (field, text) {
-    return false
-  }
-})
-
-$.extend($.fn.bootstrapTable.COLUMN_DEFAULTS, {
-  filter: undefined
-})
-
-$.extend($.fn.bootstrapTable.Constructor.EVENTS, {
-  'column-search.bs.table': 'onColumnSearch'
-})
-
-const BootstrapTable = $.fn.bootstrapTable.Constructor
-const _init = BootstrapTable.prototype.init
-const _initHeader = BootstrapTable.prototype.initHeader
-const _initSearch = BootstrapTable.prototype.initSearch
-
-BootstrapTable.prototype.init = function (...args) {
-  // Make sure that the filtercontrol option is set
-  if (this.options.filter) {
-    const that = this
-
-    if (that.options.filterTemplate) {
-      that.options.filterTemplate = $.extend({}, $.fn.bootstrapTable.defaults.filterTemplate, that.options.filterTemplate)
-    }
-
-    if (!$.isEmptyObject(that.options.filterValues)) {
-      that.filterColumnsPartial = that.options.filterValues
-      that.options.filterValues = {}
-    }
-
-    this.$el.on('reset-view.bs.table', () => {
-      // Create controls on $tableHeader if the height is set
-      if (!that.options.height) {
-        return
-      }
-
-      // Avoid recreate the controls
-      if (that.$tableHeader.find('select').length > 0 || that.$tableHeader.find('input').length > 0) {
-        return
-      }
-
-      createFilter(that, that.$tableHeader)
-    }).on('post-header.bs.table', () => {
-      let timeoutId = 0
-
-      initSelect2(that)
-      clearTimeout(timeoutId)
-      timeoutId = setTimeout(() => {
-        initFilterValues(that)
-      }, that.options.searchTimeOut - 1000)
-    }).on('column-switch.bs.table', (field, checked) => {
-      initFilterValues(that)
-    })
-  }
-
-  _init.apply(this, Array.prototype.slice.apply(args))
-}
-
-BootstrapTable.prototype.initHeader = function (...args) {
-  _initHeader.apply(this, Array.prototype.slice.apply(args))
-  if (this.options.filter) {
-    createFilter(this, this.$header)
-  }
-}
-
-BootstrapTable.prototype.initSearch = function (...args) {
-  const that = this
-  const filterValues = that.filterColumnsPartial
-
-  // Filter for client
-  if (that.options.sidePagination === 'client') {
-    this.data = this.data.filter((row, idx) => {
-      for (const field in filterValues) {
-        if (Object.prototype.hasOwnProperty(field, filterValues)) {
-          const column = that.columns[that.fieldsColumnsIndex[field]]
-          const filterValue = filterValues[field].toLowerCase()
-          let rowValue = row[field]
-
-          rowValue = $.fn.bootstrapTable.utils.calculateObjectValue(
-            that.header,
-            that.header.formatters[$.inArray(field, that.header.fields)], [rowValue, row, idx], rowValue)
-
-          if (column.filterStrictSearch) {
-            if (!($.inArray(field, that.header.fields) !== -1 &&
-              (typeof rowValue === 'string' || typeof rowValue === 'number') &&
-              rowValue.toString().toLowerCase() === filterValue.toString().toLowerCase())) {
-              return false
-            }
-          } else {
-            if (!($.inArray(field, that.header.fields) !== -1 &&
-              (typeof rowValue === 'string' || typeof rowValue === 'number') &&
-              (`${rowValue}`).toLowerCase().includes(filterValue))) {
-              return false
-            }
-          }
-        }
-      }
-
-      return true
-    })
-  }
-
-  _initSearch.apply(this, Array.prototype.slice.apply(args))
-}
-
-BootstrapTable.prototype.onColumnSearch = function (event, field, value) {
-  if ($.isEmptyObject(this.filterColumnsPartial)) {
-    this.filterColumnsPartial = {}
-  }
-
-  if (value) {
-    this.filterColumnsPartial[field] = value
-  } else {
-    delete this.filterColumnsPartial[field]
-  }
-
-  this.options.pageNumber = 1
-  this.onSearch(event)
-  this.trigger('column-search', field, value)
-}
-
-BootstrapTable.prototype.setSelect2Data = function (field, data) {
-  const that = this
-  const $header = getCurrentHeader(that)
-  const $selectEle = $header.find(`select[data-filter-field="${field}"]`)
-  $selectEle.empty()
-  $selectEle.select2({
-    data,
-    placeholder: '',
-    allowClear: true,
-    dropdownParent: that.$el.closest('.bootstrap-table')
-  })
-
-  $.each(this.columns, (idx, column) => {
-    if (column.field === field) {
-      column.filter.data = data
-      return false
-    }
-  })
-}
-
-BootstrapTable.prototype.setFilterValues = function (values) {
-  this.filterColumnsPartial = values
-}
-
-$.fn.bootstrapTable.methods.push('setSelect2Data')
-$.fn.bootstrapTable.methods.push('setFilterValues')

+ 0 - 17
src/extensions/select2-filter/extension.json

@@ -1,17 +0,0 @@
-{
-  "name": "Select2 Filter",
-  "version": "1.1.0",
-  "description": "Plugin to add select2 filter on the top of the columns in order to filter the data.",
-  "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/select2-filter",
-  "example": "http://issues.wenzhixin.net.cn/bootstrap-table/#extensions/select2-filter.html",
-
-  "plugins": [{
-    "name": "bootstrap-table-select2-filter",
-    "url": "https://github.com/wenzhixin/bootstrap-table/tree/master/src/extensions/select2-filter"
-  }],
-
-  "author": {
-    "name": "Jewway",
-    "image": "https://avatars0.githubusercontent.com/u/3501899"
-  }
-}