浏览代码

Removed resetWidth method (#4687)

文翼 6 年之前
父节点
当前提交
d701d350fb
共有 5 个文件被更改,包括 7 次插入23 次删除
  1. 4 0
      CHANGELOG.md
  2. 0 8
      site/docs/api/methods.md
  3. 1 10
      src/bootstrap-table.js
  4. 1 1
      src/constants/index.js
  5. 1 4
      tools/check-api.js

+ 4 - 0
CHANGELOG.md

@@ -1,6 +1,10 @@
 ChangeLog
 ---------
 
+### 1.15.6
+
+- **Update:** Removed `resetWidth` method and use `resetView` instead.
+
 ### 1.15.5
 
 - **New:** Added `jqXHR` for `responseHandler` option and `onLoadSuccess` event.

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

@@ -426,14 +426,6 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
 - **Example:** [Reset View](https://examples.bootstrap-table.com/#methods/reset-view.html)
 
-## resetWidth
-
-- **Parameter:** `undefined`
-
-- **Detail:**
-
-  Resizes header and footer to fit current columns width.
-
 ## showLoading
 
 - **Parameter:** `undefined`

+ 1 - 10
src/bootstrap-table.js

@@ -356,7 +356,7 @@ class BootstrapTable {
       this.$tableLoading.css('top', this.$header.outerHeight() + 1)
       // Assign the correct sortable arrow
       this.getCaret()
-      $(window).on(resizeEvent, e => this.resetWidth(e))
+      $(window).on(resizeEvent, () => this.resetView())
     }
 
     this.$selectAll = this.$header.find('[name="btSelectAll"]')
@@ -2618,15 +2618,6 @@ class BootstrapTable {
     this.trigger('reset-view')
   }
 
-  resetWidth () {
-    if (this.options.showHeader && this.options.height) {
-      this.fitHeader()
-    }
-    if (this.options.showFooter && !this.options.cardView) {
-      this.fitFooter()
-    }
-  }
-
   showLoading () {
     this.$tableLoading.css('display', 'flex')
   }

+ 1 - 1
src/constants/index.js

@@ -441,7 +441,7 @@ const METHODS = [
   'checkBy', 'uncheckBy',
   'refresh',
   'destroy',
-  'resetView', 'resetWidth',
+  'resetView',
   'showLoading', 'hideLoading',
   'togglePagination', 'toggleFullscreen', 'toggleView',
   'resetSearch',

+ 1 - 4
tools/check-api.js

@@ -85,9 +85,6 @@ class Methods extends API {
     this.file = 'methods.md'
     this.options = Constants.METHODS
     this.attributes = ['Parameter', 'Detail', 'Example']
-    this.ignore = {
-      resetWidth: ['Example']
-    }
   }
 }
 
@@ -118,4 +115,4 @@ if (errorSum === 0) {
   process.exit(0)
 }
 
-process.exit(1)
+process.exit(1)