浏览代码

added a method to reset header and footer width

Yoni Jah 10 年之前
父节点
当前提交
4cf725552f
共有 2 个文件被更改,包括 15 次插入0 次删除
  1. 5 0
      docs/_i18n/en/documentation/methods.md
  2. 10 0
      src/bootstrap-table.js

+ 5 - 0
docs/_i18n/en/documentation/methods.md

@@ -169,6 +169,11 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter);`.
         <td>Reset the bootstrap table view, for example reset the table height.</td>
         <td>Reset the bootstrap table view, for example reset the table height.</td>
     </tr>
     </tr>
     <tr>
     <tr>
+        <td>resetWidth</td>
+        <td>none</td>
+        <td>Resizes header and footer to fit current columns width</td>
+    </tr>
+    <tr>
         <td>destroy</td>
         <td>destroy</td>
         <td>none</td>
         <td>none</td>
         <td>Destroy the bootstrap table.</td>
         <td>Destroy the bootstrap table.</td>

+ 10 - 0
src/bootstrap-table.js

@@ -2082,6 +2082,15 @@
         this.initServer(params && params.silent, params && params.query);
         this.initServer(params && params.silent, params && params.query);
     };
     };
 
 
+    BootstrapTable.prototype.resetWidth = function () {
+        if (this.options.showHeader && this.options.height) {
+            this.fitHeader();
+        }
+        if (this.options.showFooter) {
+            this.fitFooter();
+        }
+    };
+
     BootstrapTable.prototype.showColumn = function (field) {
     BootstrapTable.prototype.showColumn = function (field) {
         this.toggleColumn(getFieldIndex(this.options.columns, field), true, true);
         this.toggleColumn(getFieldIndex(this.options.columns, field), true, true);
     };
     };
@@ -2150,6 +2159,7 @@
         'checkBy', 'uncheckBy',
         'checkBy', 'uncheckBy',
         'refresh',
         'refresh',
         'resetView',
         'resetView',
+        'resetWidth',
         'destroy',
         'destroy',
         'showLoading', 'hideLoading',
         'showLoading', 'hideLoading',
         'showColumn', 'hideColumn',
         'showColumn', 'hideColumn',