Browse Source

Merge pull request #4338 from wenzhixin/feature/update-docs

Added check-api tools
文翼 6 years ago
parent
commit
b81d757c04

+ 2 - 0
.npmignore

@@ -0,0 +1,2 @@
+tools
+site

+ 1 - 1
_config.yml

@@ -29,7 +29,7 @@ algolia:
 # Custom variables
 # Custom variables
 current_version:  1.14.2
 current_version:  1.14.2
 title:            "Bootstrap Table"
 title:            "Bootstrap Table"
-description:      "An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)"
+description:      "An extended table to the integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)"
 authors:          "Zhixin Wen, and Bootstrap Table contributors"
 authors:          "Zhixin Wen, and Bootstrap Table contributors"
 keywords:         "bootstrap,table,pagination,checkbox,radio,datatables,css,css-framework,semantic,semantic-ui,bulma,material,material-design,materialize,foundation"
 keywords:         "bootstrap,table,pagination,checkbox,radio,datatables,css,css-framework,semantic,semantic-ui,bulma,material,material-design,materialize,foundation"
 repo:             https://github.com/wenzhixin/bootstrap-table
 repo:             https://github.com/wenzhixin/bootstrap-table

+ 21 - 6
site/docs/api/localizations.md

@@ -1,7 +1,7 @@
 ---
 ---
 layout: docs
 layout: docs
 title: Localizations
 title: Localizations
-description: The Methods API of Bootstrap Table.
+description: The Localizations API of Bootstrap Table.
 group: api
 group: api
 toc: true
 toc: true
 ---
 ---
@@ -38,6 +38,16 @@ $('#table').bootstrapTable({
 })
 })
 {% endhighlight %}
 {% endhighlight %}
 
 
+You can custom the format localizations, the calling syntax:
+
+{% highlight javascript %}
+$('#table').bootstrapTable({
+  formatName: function () {
+    return 'Format message'
+  }
+})
+{% endhighlight %}
+
 ## formatLoadingMessage
 ## formatLoadingMessage
 
 
 - **Parameter:** `undefined`
 - **Parameter:** `undefined`
@@ -74,6 +84,12 @@ $('#table').bootstrapTable({
 
 
 - **Default:** `'No matching records found'`
 - **Default:** `'No matching records found'`
 
 
+## formatPaginationSwitch
+
+- **Parameter:** `undefined`
+
+- **Default:** `'Hide/Show pagination'`
+
 ## formatRefresh
 ## formatRefresh
 
 
 - **Parameter:** `undefined`
 - **Parameter:** `undefined`
@@ -92,14 +108,13 @@ $('#table').bootstrapTable({
 
 
 - **Default:** `'Columns'`
 - **Default:** `'Columns'`
 
 
-## formatAllRows
+## formatFullscreen
 
 
 - **Parameter:** `undefined`
 - **Parameter:** `undefined`
 
 
-- **Default:** `'All'`
-
-## formatFullscreen
+- **Default:** `'Fullscreen'`
+## formatAllRows
 
 
 - **Parameter:** `undefined`
 - **Parameter:** `undefined`
 
 
-- **Default:** `'Fullscreen'`
+- **Default:** `'All'`

+ 127 - 106
site/docs/api/methods.md

@@ -32,22 +32,6 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
 
   Return all selected rows contain search or filter, when no record selected, an empty array will return.
   Return all selected rows contain search or filter, when no record selected, an empty array will return.
 
 
-## showAllColumns
-
-- **Parameter:** `undefined`
-
-- **Detail:**
-
-  Show All the columns.
-
-## hideAllColumns
-
-- **Parameter:** `undefined`
-
-- **Detail:**
-
-  Hide All the columns.
-
 ## getData
 ## getData
 
 
 - **Parameter:** `useCurrentPage`
 - **Parameter:** `useCurrentPage`
@@ -56,14 +40,6 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
 
   Get the loaded data of table at the moment that this method is called. If you set the `useCurrentPage` to `true` the method will return the data in the current page.
   Get the loaded data of table at the moment that this method is called. If you set the `useCurrentPage` to `true` the method will return the data in the current page.
 
 
-## getRowByUniqueId
-
-- **Parameter:** `id`
-
-- **Detail:**
-
-  Get data from table, the row that contains the `id` passed by parameter.
-
 ## load
 ## load
 
 
 - **Parameter:** `data`
 - **Parameter:** `data`
@@ -107,14 +83,6 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
 
   Remove all data from table.
   Remove all data from table.
 
 
-## removeByUniqueId
-
-- **Parameter:** `id`
-
-- **Detail:**
-
-  Remove data from table, the row that contains the `id` passed by parameter.
-
 ## insertRow
 ## insertRow
 
 
 - **Parameter:** `params`
 - **Parameter:** `params`
@@ -137,6 +105,20 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
   * `index`: the row index to be updated.
   * `index`: the row index to be updated.
   * `row`: the new row data.
   * `row`: the new row data.
 
 
+## updateCell
+
+- **Parameter:** `params`
+
+- **Detail:**
+
+  Update one cell, the params contain following properties:
+
+  * `index`: the row index.
+  * `field`: the field name.
+  * `value`: the new field value.
+
+  To disable table re-initialization you can set `{reinit: false}`.
+
 ## updateByUniqueId
 ## updateByUniqueId
 
 
 - **Parameter:** `params`
 - **Parameter:** `params`
@@ -148,17 +130,21 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
   * `id`: a row id where the id should be the uniqueid field assigned to the table.
   * `id`: a row id where the id should be the uniqueid field assigned to the table.
   * `row`: the new row data.
   * `row`: the new row data.
 
 
-## updateCellById
+## removeByUniqueId
 
 
-- **Parameter:** `params`
+- **Parameter:** `id`
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Update the cell specified by the id, each params contain following properties:
+  Remove data from table, the row that contains the `id` passed by parameter.
 
 
-  * `id`: row id where the id should be the uniqueid field assigned to the table.
-  * `field`: field name of the cell to be updated.
-  * `value`: new value of the cell.
+## getRowByUniqueId
+
+- **Parameter:** `id`
+
+- **Detail:**
+
+  Get data from table, the row that contains the `id` passed by parameter.
 
 
 ## showRow
 ## showRow
 
 
@@ -203,59 +189,16 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
   * `rowspan`: the rowspan count to be merged.
   * `rowspan`: the rowspan count to be merged.
   * `colspan`: the colspan count to be merged.
   * `colspan`: the colspan count to be merged.
 
 
-## updateCell
+## refreshColumnTitle
 
 
 - **Parameter:** `params`
 - **Parameter:** `params`
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Update one cell, the params contain following properties:
+  Refresh the field title of column, the params contain following properties:
 
 
-  * `index`: the row index.
   * `field`: the field name.
   * `field`: the field name.
-  * `value`: the new field value.
-
-  To disable table re-initialization you can set `{reinit: false}`.
-
-## refresh
-
-- **Parameter:** `params`
-
-- **Detail:**
-
-  Refresh the remote server data, you can set `{silent: true}` to refresh the data silently, and set `{url: newUrl, pageNumber: pageNumber, pageSize: pageSize}` to change the url (optional), page number (optional) and page size (optional). To supply query params specific to this request, set `{query: {foo: 'bar'}}`.
-
-## refreshOptions
-
-- **Parameter:** `options`
-
-- **Detail:**
-
-  Refresh the table `options`.
-
-## resetSearch
-
-- **Parameter:** `text`
-
-- **Detail:**
-
-  Set the search `text`.
-
-## showLoading
-
-- **Parameter:** `undefined`
-
-- **Detail:**
-
-  Show loading status.
-
-## hideLoading
-
-- **Parameter:** `undefined`
-
-- **Detail:**
-
-  Hide loading status.
+  * `title`: the field title.
 
 
 ## checkAll
 ## checkAll
 
 
@@ -319,6 +262,14 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
   * `field`: name of the field used to find records.
   * `field`: name of the field used to find records.
   * `values`: array of values for rows to uncheck.
   * `values`: array of values for rows to uncheck.
 
 
+## refresh
+
+- **Parameter:** `params`
+
+- **Detail:**
+
+  Refresh the remote server data, you can set `{silent: true}` to refresh the data silently, and set `{url: newUrl, pageNumber: pageNumber, pageSize: pageSize}` to change the url (optional), page number (optional) and page size (optional). To supply query params specific to this request, set `{query: {foo: 'bar'}}`.
+
 ## resetView
 ## resetView
 
 
 - **Parameter:** `params`
 - **Parameter:** `params`
@@ -345,13 +296,29 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
 
   Destroy the Bootstrap Table.
   Destroy the Bootstrap Table.
 
 
+## showLoading
+
+- **Parameter:** `undefined`
+
+- **Detail:**
+
+  Show loading status.
+
+## hideLoading
+
+- **Parameter:** `undefined`
+
+- **Detail:**
+
+  Hide loading status.
+
 ## showColumn
 ## showColumn
 
 
 - **Parameter:** `field`
 - **Parameter:** `field`
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Show the specified `field` column.   
+  Show the specified `field` column.
   The parameter can be a string or a array of fields.
   The parameter can be a string or a array of fields.
 
 
 ## hideColumn
 ## hideColumn
@@ -360,7 +327,7 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Hide the specified `field` column.   
+  Hide the specified `field` column.
   The parameter can be a string or a array of fields.
   The parameter can be a string or a array of fields.
 
 
 ## getHiddenColumns
 ## getHiddenColumns
@@ -379,50 +346,45 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
 
   Get visible columns.
   Get visible columns.
 
 
-## scrollTo
+## showAllColumns
 
 
-- **Parameter:** `value|object`
+- **Parameter:** `undefined`
 
 
 - **Detail:**
 - **Detail:**
 
 
-  - value
-    - Scroll to the number `value` position, the unit is `'px'`, set `'bottom'` means scroll to the bottom.
-  - object
-    -  Scroll to the unit (`px` or `rows (index starts by 0)`)   
-    Default: `{unit: 'px', value: 0}`
-    
-## getScrollPosition
+  Show All the columns.
+
+## hideAllColumns
 
 
 - **Parameter:** `undefined`
 - **Parameter:** `undefined`
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Get the current scroll position, the unit is `'px'`.
+  Hide All the columns.
 
 
 ## filterBy
 ## filterBy
 
 
 - **Parameter:**
 - **Parameter:**
-    - `filter - An Object of filter`   
+    - `filter - An Object of filter`
     Default: `{}`
     Default: `{}`
-    - `options - An Object of options`   
+    - `options - An Object of options`
     Default:
     Default:
         ```
         ```
         {
         {
             'filterAlgorithm': 'and'
             'filterAlgorithm': 'and'
         }
         }
         ```
         ```
-       
 
 
 - **Detail:**
 - **Detail:**
-  
-  (Can use only in client-side) Filter data in table.   
+
+  (Can use only in client-side) Filter data in table.
   There are multiple ways to filter:
   There are multiple ways to filter:
   - Leave the options blank to use the `and` filter.
   - Leave the options blank to use the `and` filter.
   - Set the `filterAlgorithm` (see at parameter) to `or` to use the `or` filter.
   - Set the `filterAlgorithm` (see at parameter) to `or` to use the `or` filter.
   - Pass a function to the `filterAlgorithm` (see at parameter) to use a `custom` filter.
   - Pass a function to the `filterAlgorithm` (see at parameter) to use a `custom` filter.
-    
+
   #####Filter Algorithm
   #####Filter Algorithm
-  
+
   - And
   - And
     - Filter `{age: 10}` to show the data only age is equal to 10.  You can also filter with an array of values, as in: `{age: 10, hairColor: ['blue', 'red', 'green']}` to find data where age is equal to 10 and hairColor is either blue, red, or green.
     - Filter `{age: 10}` to show the data only age is equal to 10.  You can also filter with an array of values, as in: `{age: 10, hairColor: ['blue', 'red', 'green']}` to find data where age is equal to 10 and hairColor is either blue, red, or green.
   - Or
   - Or
@@ -434,6 +396,25 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
         - Filters
         - Filters
     - Return `true` to keep the row and return `false` to filter the row.
     - Return `true` to keep the row and return `false` to filter the row.
 
 
+## scrollTo
+
+- **Parameter:** `value|object`
+
+- **Detail:**
+
+  - value
+    - Scroll to the number `value` position, the unit is `'px'`, set `'bottom'` means scroll to the bottom.
+  - object
+    -  Scroll to the unit (`px` or `rows (index starts by 0)`)
+    Default: `{unit: 'px', value: 0}`
+
+## getScrollPosition
+
+- **Parameter:** `undefined`
+
+- **Detail:**
+
+  Get the current scroll position, the unit is `'px'`.
 
 
 ## selectPage
 ## selectPage
 
 
@@ -475,13 +456,21 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
 
   Toggle the card/table view.
   Toggle the card/table view.
 
 
-## toggleDetailView
+## refreshOptions
 
 
-- **Parameter:** `index`
+- **Parameter:** `options`
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Toggle the row that has the `index` passed by parameter if the detail view option is set to `true`.
+  Refresh the table `options`.
+
+## resetSearch
+
+- **Parameter:** `text`
+
+- **Detail:**
+
+  Set the search `text`.
 
 
 ## expandRow
 ## expandRow
 
 
@@ -499,14 +488,46 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
 
   Collapse the row that has the `index` passed by parameter if the detail view option is set to `true`.
   Collapse the row that has the `index` passed by parameter if the detail view option is set to `true`.
 
 
+## toggleDetailView
+
+- **Parameter:** `index`
+
+- **Detail:**
+
+  Toggle the row that has the `index` passed by parameter if the detail view option is set to `true`.
+
 ## expandAllRows
 ## expandAllRows
 
 
+- **Parameter:** `undefined`
+
 - **Detail:**
 - **Detail:**
 
 
   Expand all rows if the detail view option is set to `true`.
   Expand all rows if the detail view option is set to `true`.
 
 
 ## collapseAllRows
 ## collapseAllRows
 
 
+- **Parameter:** `undefined`
+
 - **Detail:**
 - **Detail:**
 
 
   Collapse all rows if the detail view option is set to `true`.
   Collapse all rows if the detail view option is set to `true`.
+
+## updateFormatText
+
+- **Parameter:** `formatName, text`
+
+- **Detail:**
+
+  Update the localizations format text.
+
+## updateCellById
+
+- **Parameter:** `params`
+
+- **Detail:**
+
+  Update the cell specified by the id, each params contain following properties:
+
+  * `id`: row id where the id should be the uniqueid field assigned to the table.
+  * `field`: field name of the cell to be updated.
+  * `value`: new value of the cell.

+ 82 - 42
site/docs/api/table-options.md

@@ -136,10 +136,10 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
   * First tries for the locale as specified,
   * First tries for the locale as specified,
   * Then tries the locale with '_' translated to '-' and the region code upper cased,
   * Then tries the locale with '_' translated to '-' and the region code upper cased,
-  * Then tries the the short locale code (i.e. `'zh'` instead of `'fr-CA'`),
+  * Then tries the short locale code (i.e. `'zh'` instead of `'zh-CN'`),
   * And finally will use the last locale file loaded (or the default locale if no locales loaded).
   * And finally will use the last locale file loaded (or the default locale if no locales loaded).
 
 
-  If left `undefined` or an empty string, uses the last locale loaded (or `'en-US'` if no locale files loaded).
+  If left `undefined` or an empty string, use the last locale loaded (or `'en-US'` if no locale files loaded).
 
 
 - **Default:** `undefined`
 - **Default:** `undefined`
 
 
@@ -181,7 +181,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Set `false` to sort the data with loading message. This options works when the sidePagination option is set to `'server'`.
+  Set `false` to sort the data with the loading message. This options works when the sidePagination option is set to `'server'`.
 
 
 - **Default:** `true`
 - **Default:** `true`
 
 
@@ -251,7 +251,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Detail:**
 - **Detail:**
 
 
-  The custom sort function is executed instead of built-in sort function, takes three parameters:
+  The custom sort function is executed instead of the built-in sort function, takes three parameters:
 
 
   * `sortName`: the sort name.
   * `sortName`: the sort name.
   * `sortOrder`: the sort order.
   * `sortOrder`: the sort order.
@@ -306,12 +306,12 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Default:** `undefined`
 - **Default:** `undefined`
 
 
+- **Example:** [From URL](https://examples.bootstrap-table.com/#welcomes/from-url.html)
+
 - **Error handling**
 - **Error handling**
 
 
   To get loading errors please use [onLoadError](https://bootstrap-table.com/docs/api/events/#onloaderror)
   To get loading errors please use [onLoadError](https://bootstrap-table.com/docs/api/events/#onloaderror)
 
 
-- **Example:** [From URL](https://examples.bootstrap-table.com/#welcomes/from-url.html)
-
 ## method
 ## method
 
 
 - **Attribute:** `data-method`
 - **Attribute:** `data-method`
@@ -460,6 +460,20 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Example:** [Total/Data Field](https://examples.bootstrap-table.com/#options/total-data-field.html)
 - **Example:** [Total/Data Field](https://examples.bootstrap-table.com/#options/total-data-field.html)
 
 
+## totalNotFilteredField
+
+- **Attribute:** `data-total-not-filtered-field`
+
+- **Type:** `string`
+
+- **Detail:**
+
+  The field from the json response which will used for `showExtendedPagination`.
+
+- **Default:** `totalNotFiltered`
+
+- **Example:** [Total Not Filtered Field](https://examples.bootstrap-table.com/#options/total-not-filtered-field.html)
+
 ## dataField
 ## dataField
 
 
 - **Attribute:** `data-data-field`
 - **Attribute:** `data-data-field`
@@ -511,26 +525,12 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 - **Detail:**
 - **Detail:**
 
 
   Set `true` to show a extended version of pagination (including the count of all rows with out filters).
   Set `true` to show a extended version of pagination (including the count of all rows with out filters).
-  If you use pagination on the server side pls use totalNotFilteredField to define the count.
+  If you use pagination on the server side pls use `totalNotFilteredField` to define the count.
 
 
 - **Default:** `false`
 - **Default:** `false`
 
 
 - **Example:** [Show Extended Pagination](https://examples.bootstrap-table.com/#options/show-extended-pagination.html)
 - **Example:** [Show Extended Pagination](https://examples.bootstrap-table.com/#options/show-extended-pagination.html)
 
 
-## totalNotFilteredField
-
-- **Attribute:** `data-total-not-filtered-field`
-
-- **Type:** `string`
-
-- **Detail:**
-
-  The field from the json response which will used for showExtendedPagination.
-
-- **Default:** `totalNotFiltered`
-
-- **Example:** [Total Not Filtered Field](https://examples.bootstrap-table.com/#options/total-not-filtered-field.html)
-
 ## paginationLoop
 ## paginationLoop
 
 
 - **Attribute:** `data-pagination-loop`
 - **Attribute:** `data-pagination-loop`
@@ -556,7 +556,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
   Defines the side pagination of the table, can only be `'client'` or `'server'`.
   Defines the side pagination of the table, can only be `'client'` or `'server'`.
   Using `'server'` side requires either setting the `'url'` or `'ajax'` option.
   Using `'server'` side requires either setting the `'url'` or `'ajax'` option.
 
 
-  Note that the required server response format is different depending on whether the `'client'` or `'server'` option is specified. See the following examples:
+  Note that the required server response format is different depending on whether the  `'sidePagination'` option is set to `'client'` or `'server'`. See the following examples:
 
 
   * [Without server-side pagination](https://github.com/wenzhixin/bootstrap-table-examples/blob/master/json/data1.json)
   * [Without server-side pagination](https://github.com/wenzhixin/bootstrap-table-examples/blob/master/json/data1.json)
   * [With server-side pagination](https://github.com/wenzhixin/bootstrap-table-examples/blob/master/json/data2.json)
   * [With server-side pagination](https://github.com/wenzhixin/bootstrap-table-examples/blob/master/json/data2.json)
@@ -577,6 +577,18 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Default:** `0`
 - **Default:** `0`
 
 
+## totalNotFiltered
+
+- **Attribute:** `data-total-not-filtered`
+
+- **Type:** `Number`
+
+- **Detail:**
+
+  This property is mainly passed in by pagination server, which is easy to use.
+
+- **Default:** `0`
+
 ## pageNumber
 ## pageNumber
 
 
 - **Attribute:** `data-page-number`
 - **Attribute:** `data-page-number`
@@ -725,7 +737,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Calculate and show intermediate pages for quick access
+  Calculate and show intermediate pages for quick access.
 
 
 - **Default:** `false`
 - **Default:** `false`
 
 
@@ -746,7 +758,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
     Example: Github contains git.
     Example: Github contains git.
   - The value must be identical to the search query.
   - The value must be identical to the search query.
     Example: Github (value) and Github (search query).
     Example: Github (value) and Github (search query).
-  - Comparisons (<, >, <=, =<, >=, =>)
+  - Comparisons (<, >, <=, =<, >=, =>).
     Example: 4 is larger than 3.
     Example: 4 is larger than 3.
 
 
 - **Default:** `false`
 - **Default:** `false`
@@ -905,7 +917,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
   * `column`: the column object.
   * `column`: the column object.
 
 
-  Support classes or css. Example usage:
+  Support `classes` or `css`. Example usage:
 
 
   {% highlight javascript %}
   {% highlight javascript %}
   function footerStyle(column) {
   function footerStyle(column) {
@@ -1032,6 +1044,20 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Example:** [Table Escape](https://examples.bootstrap-table.com/#options/table-escape.html)
 - **Example:** [Table Escape](https://examples.bootstrap-table.com/#options/table-escape.html)
 
 
+## filterOptions
+
+- **Attribute:** `data-filter-options`
+
+- **Type:** `Boolean`
+
+- **Detail:**
+
+  Define the default filter options of algorithm, `filterAlgorithm: 'and'` means all given filter must match, `filterAlgorithm: 'or'` means one of the given filter must match.
+
+- **Default:** `{ filterAlgorithm: 'and' }`
+
+- **Example:** [Filter Options](https://examples.bootstrap-table.com/#options/filter-options.html)
+
 ## idField
 ## idField
 
 
 - **Attribute:** `data-id-field`
 - **Attribute:** `data-id-field`
@@ -1128,7 +1154,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Set `true` to maintain the following meta data on change page and search
+  Set `true` to maintain the following meta data on change page and search:
    * selected rows
    * selected rows
    * hidden rows
    * hidden rows
 
 
@@ -1206,6 +1232,20 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Example:** [Detail View Icon](https://examples.bootstrap-table.com/#options/detail-view-icon.html)
 - **Example:** [Detail View Icon](https://examples.bootstrap-table.com/#options/detail-view-icon.html)
 
 
+## detailViewByClick
+
+- **Attribute:** `data-detail-view-by-click`
+
+- **Type:** `Boolean`
+
+- **Detail:**
+
+  Set `true` to toggle the detail view, when a cell is clicked.
+
+- **Default:** `false`
+
+- **Example:** [Detail View Icon](https://examples.bootstrap-table.com/#options/detail-view-icon.html)
+
 ## detailFormatter
 ## detailFormatter
 
 
 - **Attribute:** `data-detail-formatter`
 - **Attribute:** `data-detail-formatter`
@@ -1214,7 +1254,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Format your detail view when detailView is set to true. Return a String and it will be appended into the detail view cell, optionally render the element directly using the third parameter which is a jQuery element of the target cell.
+  Format your detail view when `detailView` is set to `true`. Return a String and it will be appended into the detail view cell, optionally render the element directly using the third parameter which is a jQuery element of the target cell.
 
 
 - **Default:** `function(index, row, element) { return '' }`
 - **Default:** `function(index, row, element) { return '' }`
 
 
@@ -1228,26 +1268,12 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Detail:**
 - **Detail:**
 
 
-  Enable expansion per row when detailView is set to true. Return true and the row will be enabled for expansion, return false and expansion for the row will be disabled. Default function returns true to enable expansion for all rows.
+  Enable expansion per row when `detailView` is set to `true`. Return true and the row will be enabled for expansion, return false and expansion for the row will be disabled. Default function returns true to enable expansion for all rows.
 
 
 - **Default:** `function(index, row) { return true }`
 - **Default:** `function(index, row) { return true }`
 
 
 - **Example:** [Detail Filter](https://examples.bootstrap-table.com/#options/detail-filter.html)
 - **Example:** [Detail Filter](https://examples.bootstrap-table.com/#options/detail-filter.html)
 
 
-## detailViewByClick
-
-- **Attribute:** `data-detail-view-by-click`
-
-- **Type:** `Boolean`
-
-- **Detail:**
-
-  Set `true` to toggle the detail view, when a cell is clicked.
-
-- **Default:** `false`
-
-- **Example:** [Detail View Icon](https://examples.bootstrap-table.com/#options/detail-view-icon.html)
-
 ## toolbar
 ## toolbar
 
 
 - **Attribute:** `data-toolbar`
 - **Attribute:** `data-toolbar`
@@ -1304,6 +1330,20 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Example:** [Buttons Align](https://examples.bootstrap-table.com/#options/buttons-align.html)
 - **Example:** [Buttons Align](https://examples.bootstrap-table.com/#options/buttons-align.html)
 
 
+## buttonsPrefix
+
+- **Attribute:** `data-buttons-prefix`
+
+- **Type:** `String`
+
+- **Detail:**
+
+  Defines prefix of table buttons.
+
+- **Default:** `'btn'`
+
+- **Example:** [Buttons Prefix](https://examples.bootstrap-table.com/#options/buttons-prefix.html)
+
 ## buttonsClass
 ## buttonsClass
 
 
 - **Attribute:** `data-buttons-class`
 - **Attribute:** `data-buttons-class`

+ 1 - 1
site/docs/getting-started/browsers-devices.md

@@ -10,7 +10,7 @@ toc: true
 
 
 Bootstrap Table supports the **latest, stable releases** of all major browsers and platforms. On Windows, **we support Internet Explorer 10-11 / Microsoft Edge**.
 Bootstrap Table supports the **latest, stable releases** of all major browsers and platforms. On Windows, **we support Internet Explorer 10-11 / Microsoft Edge**.
 
 
-Alternative browsers which use the latest version of WebKit, Blink, or Gecko, whether directly or via the platform's web view API, are not explicitly supported. However, Bootstrap should (in most cases) display and function correctly in these browsers as well. More specific support information is provided below.
+Alternative browsers which use the latest version of WebKit, Blink, or Gecko, whether directly or via the platform's web view API, are not explicitly supported. However, Bootstrap Table should (in most cases) display and function correctly in these browsers as well. More specific support information is provided below.
 
 
 You can find our supported range of browsers and their versions [in our `.browserslistrc file`]({{ site.repo }}/blob/{{ site.current_version }}/.browserslistrc):
 You can find our supported range of browsers and their versions [in our `.browserslistrc file`]({{ site.repo }}/blob/{{ site.current_version }}/.browserslistrc):
 
 

+ 11 - 41
src/bootstrap-table.js

@@ -2662,13 +2662,14 @@ class BootstrapTable {
     }
     }
   }
   }
 
 
-  updateFormatText (name, text) {
-    if (this.options[Utils.sprintf('format%s', name)]) {
-      if (typeof text === 'string') {
-        this.options[Utils.sprintf('format%s', name)] = () => text
-      } else if (typeof text === 'function') {
-        this.options[Utils.sprintf('format%s', name)] = text
-      }
+  updateFormatText (formatName, text) {
+    if (!/^format/.test(formatName) || !this.options[formatName]) {
+      return
+    }
+    if (typeof text === 'string') {
+      this.options[formatName] = () => text
+    } else if (typeof text === 'function') {
+      this.options[formatName] = text
     }
     }
     this.initToolbar()
     this.initToolbar()
     this.initPagination()
     this.initPagination()
@@ -2680,43 +2681,12 @@ BootstrapTable.VERSION = Constants.VERSION
 BootstrapTable.DEFAULTS = Constants.DEFAULTS
 BootstrapTable.DEFAULTS = Constants.DEFAULTS
 BootstrapTable.LOCALES = Constants.LOCALES
 BootstrapTable.LOCALES = Constants.LOCALES
 BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS
 BootstrapTable.COLUMN_DEFAULTS = Constants.COLUMN_DEFAULTS
+BootstrapTable.METHODS = Constants.METHODS
 BootstrapTable.EVENTS = Constants.EVENTS
 BootstrapTable.EVENTS = Constants.EVENTS
 
 
 // BOOTSTRAP TABLE PLUGIN DEFINITION
 // BOOTSTRAP TABLE PLUGIN DEFINITION
 // =======================
 // =======================
 
 
-const allowedMethods = [
-  'getOptions',
-  'getSelections', 'getAllSelections', 'getData',
-  'load', 'append', 'prepend', 'remove', 'removeAll',
-  'insertRow', 'updateRow', 'updateCell',
-  'updateByUniqueId', 'removeByUniqueId',
-  'getRowByUniqueId', 'showRow', 'hideRow', 'getHiddenRows',
-  'mergeCells', 'refreshColumnTitle',
-  'checkAll', 'uncheckAll', 'checkInvert',
-  'check', 'uncheck',
-  'checkBy', 'uncheckBy',
-  'refresh',
-  'resetView',
-  'resetWidth',
-  'destroy',
-  'showLoading', 'hideLoading',
-  'showColumn', 'hideColumn',
-  'getHiddenColumns', 'getVisibleColumns',
-  'showAllColumns', 'hideAllColumns',
-  'filterBy',
-  'scrollTo',
-  'getScrollPosition',
-  'selectPage', 'prevPage', 'nextPage',
-  'togglePagination',
-  'toggleView',
-  'refreshOptions',
-  'resetSearch',
-  'expandRow', 'collapseRow', 'toggleDetailView',
-  'expandAllRows', 'collapseAllRows',
-  'updateFormatText', 'updateCellById'
-]
-
 $.BootstrapTable = BootstrapTable
 $.BootstrapTable = BootstrapTable
 $.fn.bootstrapTable = function (option, ...args) {
 $.fn.bootstrapTable = function (option, ...args) {
   let value
   let value
@@ -2727,7 +2697,7 @@ $.fn.bootstrapTable = function (option, ...args) {
       typeof option === 'object' && option)
       typeof option === 'object' && option)
 
 
     if (typeof option === 'string') {
     if (typeof option === 'string') {
-      if (!allowedMethods.includes(option)) {
+      if (!Constants.METHODS.includes(option)) {
         throw new Error(`Unknown method: ${option}`)
         throw new Error(`Unknown method: ${option}`)
       }
       }
 
 
@@ -2757,7 +2727,7 @@ $.fn.bootstrapTable.defaults = BootstrapTable.DEFAULTS
 $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS
 $.fn.bootstrapTable.columnDefaults = BootstrapTable.COLUMN_DEFAULTS
 $.fn.bootstrapTable.events = BootstrapTable.EVENTS
 $.fn.bootstrapTable.events = BootstrapTable.EVENTS
 $.fn.bootstrapTable.locales = BootstrapTable.LOCALES
 $.fn.bootstrapTable.locales = BootstrapTable.LOCALES
-$.fn.bootstrapTable.methods = allowedMethods
+$.fn.bootstrapTable.methods = BootstrapTable.METHODS
 $.fn.bootstrapTable.utils = Utils
 $.fn.bootstrapTable.utils = Utils
 
 
 // BOOTSTRAP TABLE INIT
 // BOOTSTRAP TABLE INIT

+ 37 - 3
src/constants/index.js

@@ -173,7 +173,7 @@ const DEFAULTS = {
   smartDisplay: true,
   smartDisplay: true,
   escape: false,
   escape: false,
   filterOptions: {
   filterOptions: {
-    'filterAlgorithm': 'and' // and means all given filter must match, or means one of the given filter must match
+    filterAlgorithm: 'and'
   },
   },
   idField: undefined,
   idField: undefined,
   selectItemName: 'btSelectItem',
   selectItemName: 'btSelectItem',
@@ -369,12 +369,44 @@ const COLUMN_DEFAULTS = {
   events: undefined
   events: undefined
 }
 }
 
 
+const METHODS = [
+  'getOptions',
+  'getSelections', 'getAllSelections', 'getData',
+  'load', 'append', 'prepend', 'remove', 'removeAll',
+  'insertRow', 'updateRow', 'updateCell',
+  'updateByUniqueId', 'removeByUniqueId',
+  'getRowByUniqueId', 'showRow', 'hideRow', 'getHiddenRows',
+  'mergeCells', 'refreshColumnTitle',
+  'checkAll', 'uncheckAll', 'checkInvert',
+  'check', 'uncheck',
+  'checkBy', 'uncheckBy',
+  'refresh',
+  'resetView',
+  'resetWidth',
+  'destroy',
+  'showLoading', 'hideLoading',
+  'showColumn', 'hideColumn',
+  'getHiddenColumns', 'getVisibleColumns',
+  'showAllColumns', 'hideAllColumns',
+  'filterBy',
+  'scrollTo',
+  'getScrollPosition',
+  'selectPage', 'prevPage', 'nextPage',
+  'togglePagination',
+  'toggleView',
+  'refreshOptions',
+  'resetSearch',
+  'expandRow', 'collapseRow', 'toggleDetailView',
+  'expandAllRows', 'collapseAllRows',
+  'updateFormatText', 'updateCellById'
+]
+
 const EVENTS = {
 const EVENTS = {
   'all.bs.table': 'onAll',
   'all.bs.table': 'onAll',
-  'click-cell.bs.table': 'onClickCell',
-  'dbl-click-cell.bs.table': 'onDblClickCell',
   'click-row.bs.table': 'onClickRow',
   'click-row.bs.table': 'onClickRow',
   'dbl-click-row.bs.table': 'onDblClickRow',
   'dbl-click-row.bs.table': 'onDblClickRow',
+  'click-cell.bs.table': 'onClickCell',
+  'dbl-click-cell.bs.table': 'onDblClickCell',
   'sort.bs.table': 'onSort',
   'sort.bs.table': 'onSort',
   'check.bs.table': 'onCheck',
   'check.bs.table': 'onCheck',
   'uncheck.bs.table': 'onUncheck',
   'uncheck.bs.table': 'onUncheck',
@@ -413,6 +445,8 @@ export default {
 
 
   COLUMN_DEFAULTS,
   COLUMN_DEFAULTS,
 
 
+  METHODS,
+
   EVENTS,
   EVENTS,
 
 
   LOCALES: {
   LOCALES: {

+ 7 - 0
tools/README.md

@@ -0,0 +1,7 @@
+# Tools
+
+## check-api
+
+```
+node --experimental-modules --loader ./loader.mjs check-api.js
+```

+ 100 - 0
tools/check-api.js

@@ -0,0 +1,100 @@
+import fs from 'fs'
+import Constants from '../src/constants/index.js'
+
+class API {
+  constructor () {
+    this.init()
+    this.check()
+  }
+
+  check () {
+    const file = `../site/docs/api/${this.file}`
+    const md = {}
+    const content = fs.readFileSync(file).toString()
+    const lines = content.split('## ')
+    const outLines = lines.slice(0, 1)
+
+    console.log('-------------------------')
+    console.log(`Checking file: ${file}`)
+    console.log('-------------------------')
+
+    for (const item of lines.slice(1)) {
+      md[item.split('\n')[0]] = item
+    }
+
+    const mds = Object.keys(md)
+    for (const [i, key] of this.options.entries()) {
+      if (md[key]) {
+        outLines.push(md[key])
+        const details = md[key].split('\n\n- ')
+
+        for (let i = 0; i < this.attributes.length; i++) {
+          const name = this.attributes[i]
+          if (this.ignore && this.ignore[key] && this.ignore[key].includes(name)) {
+            continue
+          }
+          if (!details[i + 1] || details[i + 1].indexOf(`**${name}:**`) === -1) {
+            console.log(`${key} missing ${name}`)
+          }
+        }
+      } else {
+        outLines.push(key + '\n\n')
+      }
+    }
+
+    fs.writeFile(file, outLines.join('## '), () => {})
+  }
+}
+
+class TableOptions extends API {
+  init () {
+    this.file = 'table-options.md'
+    this.options = Object.keys(Constants.DEFAULTS).filter(it => {
+      return !/^(on|format)[A-Z]/.test(it)
+    })
+    this.options.unshift('-')
+    this.attributes = ['Attribute', 'Type', 'Detail', 'Default', 'Example']
+    this.ignore = {
+      totalRows: ['Example'],
+      totalNotFiltered: ['Example']
+    }
+  }
+}
+
+class ColumnOptions extends API {
+  init () {
+    this.file = 'column-options.md'
+    this.options = Object.keys(Constants.COLUMN_DEFAULTS)
+    this.attributes = ['Attribute', 'Type', 'Detail', 'Default']// , 'Example']
+  }
+}
+
+class Methods extends API {
+  init () {
+    this.file = 'methods.md'
+    this.options = Constants.METHODS
+    this.attributes = ['Parameter', 'Detail']// , 'Example']
+  }
+}
+
+class Events extends API {
+  init () {
+    this.file = 'events.md'
+    this.options = Object.values(Constants.EVENTS)
+    this.attributes = ['jQuery Event', 'Parameter', 'Detail']
+  }
+}
+
+class Localizations extends API {
+  init () {
+    this.file = 'localizations.md'
+    this.options = Object.keys(Constants.LOCALES.en)
+    this.attributes = ['Parameter', 'Default']
+  }
+}
+
+new TableOptions()
+new ColumnOptions()
+new Methods()
+new Events()
+new Localizations()

+ 34 - 0
tools/loader.mjs

@@ -0,0 +1,34 @@
+import path from 'path'
+import process from 'process'
+import Module from 'module'
+
+const builtins = Module.builtinModules
+const JS_EXTENSIONS = new Set(['.js', '.mjs'])
+
+const baseURL = new URL('file://')
+baseURL.pathname = `${process.cwd()}/`
+
+export function resolve (specifier, parentModuleURL = baseURL, defaultResolve) {
+  if (builtins.includes(specifier)) {
+    return {
+      url: specifier,
+      format: 'builtin'
+    }
+  }
+  if (/^\.{0,2}[/]/.test(specifier) !== true && !specifier.startsWith('file:')) {
+    // For node_modules support:
+    // return defaultResolve(specifier, parentModuleURL);
+    throw new Error(
+      `imports must begin with '/', './', or '../'; '${specifier}' does not`)
+  }
+  const resolved = new URL(specifier, parentModuleURL)
+  const ext = path.extname(resolved.pathname)
+  if (!JS_EXTENSIONS.has(ext)) {
+    throw new Error(
+      `Cannot load file with non-JavaScript file extension ${ext}.`)
+  }
+  return {
+    url: resolved.href,
+    format: 'esm'
+  }
+}