浏览代码

Add resetView method.

zhixin 11 年之前
父节点
当前提交
f4e2116002
共有 2 个文件被更改,包括 11 次插入10 次删除
  1. 1 0
      docs/docs.js
  2. 10 10
      src/bootstrap-table.js

+ 1 - 0
docs/docs.js

@@ -277,6 +277,7 @@ $(function () {
             {name: 'mergeCells', parameter: 'options', description: 'colspan: the colspan count to be merged.'},
             {name: 'checkAll', parameter: 'none', description: 'Check all current page rows.'},
             {name: 'uncheckAll', parameter: 'none', description: 'Uncheck all current page rows.'},
+            {name: 'resetView', parameter: 'none', description: 'Reset the bootstrap table view, like display error when init the table with display: none.'},
             {name: 'destroy', parameter: 'none', description: 'Destroy the bootstrap table.'}
         ]).bootstrapTable('mergeCells', {
             index: 3,

+ 10 - 10
src/bootstrap-table.js

@@ -548,15 +548,6 @@
             '</span>'].join('');
     };
 
-    BootstrapTable.prototype.resetView = function() {
-        var header = this.header;
-
-        this.$header.find('.th-inner').each(function(i) {
-            $(this).attr('style', header.styles[i])
-                .css('width', ($(this).parent().width()) + 'px'); // padding: 8px
-        });
-    };
-
     BootstrapTable.prototype.updateRows = function(checked) {
         var that = this;
 
@@ -578,6 +569,15 @@
     // PUBLIC FUNCTION DEFINITION
     // =======================
 
+    BootstrapTable.prototype.resetView = function() {
+        var header = this.header;
+
+        this.$header.find('.th-inner').each(function(i) {
+            $(this).attr('style', header.styles[i])
+                .css('width', ($(this).parent().width()) + 'px'); // padding: 8px
+        });
+    };
+
     BootstrapTable.prototype.load = function(data) {
         this.initData(data);
         this.initPagination();
@@ -646,7 +646,7 @@
                 'getSelections',
                 'load', 'append', 'mergeCells',
                 'checkAll', 'uncheckAll',
-                'destroy'
+                'resetView', 'destroy'
             ],
             value;