Browse Source

Added events before and after initBody

Yoni Jah 11 years ago
parent
commit
aa2a28f9e6

File diff suppressed because it is too large
+ 2 - 2
dist/bootstrap-table.min.js


+ 12 - 0
docs/_includes/documentation/events.md

@@ -118,5 +118,17 @@
         <td>text</td>
         <td>text</td>
         <td>Fires when search the table.</td>
         <td>Fires when search the table.</td>
     </tr>
     </tr>
+     <tr>
+        <td>onPreBody</td>
+        <td>pre-body.bs.table</td>
+        <td>data</td>
+        <td>Fires before the table body is rendered</td>
+    </tr>
+     <tr>
+        <td>onPostBody</td>
+        <td>post-body.bs.table</td>
+        <td></td>
+        <td>Fires after the table body is rendered and available in the DOM</td>
+    </tr>
     </tbody>
     </tbody>
 </table>
 </table>

File diff suppressed because it is too large
+ 2 - 2
docs/dist/bootstrap-table.min.js


+ 7 - 1
src/bootstrap-table.js

@@ -245,7 +245,9 @@
         'load-error.bs.table': 'onLoadError',
         'load-error.bs.table': 'onLoadError',
         'column-switch.bs.table': 'onColumnSwitch',
         'column-switch.bs.table': 'onColumnSwitch',
         'page-change.bs.table': 'onPageChange',
         'page-change.bs.table': 'onPageChange',
-        'search.bs.table': 'onSearch'
+        'search.bs.table': 'onSearch',
+        'pre-body.bs.table': 'onPreBody',
+        'post-body.bs.table': 'onPostBody'
     };
     };
 
 
     BootstrapTable.prototype.init = function () {
     BootstrapTable.prototype.init = function () {
@@ -896,6 +898,8 @@
             html = [],
             html = [],
             data = this.getData();
             data = this.getData();
 
 
+        this.trigger('pre-body', data);
+
         this.$body = this.$el.find('tbody');
         this.$body = this.$el.find('tbody');
         if (!this.$body.length) {
         if (!this.$body.length) {
             this.$body = $('<tbody></tbody>').appendTo(this.$el);
             this.$body = $('<tbody></tbody>').appendTo(this.$el);
@@ -1113,6 +1117,8 @@
 
 
         this.updateSelected();
         this.updateSelected();
         this.resetView();
         this.resetView();
+
+        this.trigger('post-body');
     };
     };
 
 
     BootstrapTable.prototype.initServer = function (silent) {
     BootstrapTable.prototype.initServer = function (silent) {