Browse Source

Added searchable table option

飞鱼 2 years ago
parent
commit
32eb946d01
4 changed files with 18 additions and 0 deletions
  1. 1 0
      CHANGELOG.md
  2. 15 0
      site/docs/api/table-options.md
  3. 1 0
      src/bootstrap-table.js
  4. 1 0
      src/constants/index.js

+ 1 - 0
CHANGELOG.md

@@ -5,6 +5,7 @@ ChangeLog
 
 #### Core
 
+- **New:** Added searchable table option to enable sending searchable (columns) parameters.
 - **Update:** Fixed Maximum call stack size exceeded error.
 - **Update:** Fixed getData bug with hidden rows.
 - **Update:** Added support for `select` form to the `searchSelector` option.

+ 15 - 0
site/docs/api/table-options.md

@@ -1196,11 +1196,26 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
   Notes:
   - If you want to use a custom search input, use the [searchSelector](https://bootstrap-table.com/docs/api/table-options/#searchSelector).
   - You can also search via regex using the [regexSearch](https://bootstrap-table.com/docs/api/table-options/#regexSearch) option.
+  - If you want to send searchable params to server-side pagination, use the [searchable](https://bootstrap-table.com/docs/api/table-options/#searchable) option.
 
 - **Default:** `false`
 
 - **Example:** [Table Search](https://examples.bootstrap-table.com/#options/table-search.html)
 
+## searchable
+
+- **Attribute:** `data-searchable`
+
+- **Type:** `Boolean`
+
+- **Detail:**
+
+  Set `true` to send [searchable params](https://bootstrap-table.com/docs/api/column-options/#searchable) to the server while using server-side pagination.
+
+- **Default:** `false`
+
+- **Example:** [Searchable](https://examples.bootstrap-table.com/#options/searchable.html)
+
 ## searchAccentNeutralise
 
 - **Attribute:** `data-search-accent-neutralise`

+ 1 - 0
src/bootstrap-table.js

@@ -1977,6 +1977,7 @@ class BootstrapTable {
     if (
       this.options.search &&
       this.options.sidePagination === 'server' &&
+      this.options.searchable &&
       this.columns.filter(column => column.searchable).length
     ) {
       params.searchable = []

+ 1 - 0
src/constants/index.js

@@ -179,6 +179,7 @@ const DEFAULTS = {
   paginationPagesBySide: 1, // Number of pages on each side (right, left) of the current page.
   paginationUseIntermediate: false, // Calculate intermediate pages for quick access
   search: false,
+  searchable: false,
   searchHighlight: false,
   searchOnEnterKey: false,
   strictSearch: false,