浏览代码

Merge pull request #548 from NaughtyMC/patch-1

Fixes #536
文翼 11 年之前
父节点
当前提交
aa969dabd2
共有 2 个文件被更改,包括 13 次插入2 次删除
  1. 5 0
      docs/_i18n/en/documentation/events.md
  2. 8 2
      src/bootstrap-table.js

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

@@ -130,5 +130,10 @@
         <td>none</td>
         <td>none</td>
         <td>Fires after the table body is rendered and available in the DOM</td>
         <td>Fires after the table body is rendered and available in the DOM</td>
     </tr>
     </tr>
+    <tr>
+       <td>onPostHeader</td>
+       <td>post-header.bs.table</td>
+       <td>none</td>
+       <td>Fires after the table header is rendered and availble in the DOM</td>
     </tbody>
     </tbody>
 </table>
 </table>

+ 8 - 2
src/bootstrap-table.js

@@ -195,7 +195,8 @@
         onPageChange: function (number, size) {return false;},
         onPageChange: function (number, size) {return false;},
         onSearch: function (text) {return false;},
         onSearch: function (text) {return false;},
         onPreBody: function (data) {return false;},
         onPreBody: function (data) {return false;},
-        onPostBody: function () {return false;}
+        onPostBody: function () {return false;},
+        onPostHeader: function() {return false;}
     };
     };
 
 
     BootstrapTable.LOCALES = [];
     BootstrapTable.LOCALES = [];
@@ -270,7 +271,8 @@
         'page-change.bs.table': 'onPageChange',
         'page-change.bs.table': 'onPageChange',
         'search.bs.table': 'onSearch',
         'search.bs.table': 'onSearch',
         'pre-body.bs.table': 'onPreBody',
         'pre-body.bs.table': 'onPreBody',
-        'post-body.bs.table': 'onPostBody'
+        'post-body.bs.table': 'onPostBody',
+        'post-header.bs.table' : 'onPostHeader'
     };
     };
 
 
     BootstrapTable.prototype.init = function () {
     BootstrapTable.prototype.init = function () {
@@ -1329,6 +1331,8 @@
             $fixedBody.off('scroll').on('scroll', function () {
             $fixedBody.off('scroll').on('scroll', function () {
                 $fixedHeader.scrollLeft($(this).scrollLeft());
                 $fixedHeader.scrollLeft($(this).scrollLeft());
             });
             });
+            
+            that.trigger('post-header');
         });
         });
     };
     };
 
 
@@ -1386,6 +1390,8 @@
 
 
         if (this.options.showHeader && this.options.height) {
         if (this.options.showHeader && this.options.height) {
             this.resetHeader();
             this.resetHeader();
+        } else {
+            this.trigger('post-header');
         }
         }
 
 
         if (this.options.height && this.options.showHeader) {
         if (this.options.height && this.options.showHeader) {