ソースを参照

Fix #1838

Added onRefresh event
Dennis Hernández 9 年 前
コミット
6478bd4912

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

@@ -237,5 +237,11 @@ $('#table').on('event-name.bs.table', function (e, arg1, arg2, ...) {
         <td></td>
         <td>Fires when reset view of the table.</td>
     </tr>
+    <tr>
+       <td>onRefresh</td>
+       <td>refresh.bs.table</td>
+       <td>params</td>
+       <td>Fires after the click the refresh button.</td>
+    </tr>
     </tbody>
 </table>

+ 7 - 1
docs/_i18n/es/documentation/events.md

@@ -202,7 +202,13 @@
        <td>onRefreshOptions</td>
        <td>refresh-options.bs.table</td>
        <td>options</td>
-       <td>Se ejecuta cuando se actualiza el objeto options, este método se ejecuta antes de los eventos destroy e init</td>
+       <td>Se ejecuta cuando se actualiza el objeto options, este método se ejecuta antes de los eventos destroy e init.</td>
+    </tr>
+    <tr>
+       <td>onRefresh</td>
+       <td>refresh.bs.table</td>
+       <td>params</td>
+       <td>Se ejecuta cuando se cliquea el botón de refresh.</td>
     </tr>
     </tbody>
 </table>

+ 7 - 1
docs/_i18n/zh-cn/documentation/events.md

@@ -215,7 +215,13 @@
        <td>onRefreshOptions</td>
        <td>refresh-options.bs.table</td>
        <td>options</td>
-       <td>Fires after refresh the options and before destroy and init the table</td>
+       <td>Fires after refresh the options and before destroy and init the table.</td>
+    </tr>
+    <tr>
+       <td>onRefresh</td>
+       <td>refresh.bs.table</td>
+       <td>params</td>
+       <td>Fires after the click the refresh button.</td>
     </tr>
     </tbody>
 </table>

+ 6 - 1
src/bootstrap-table.js

@@ -465,6 +465,9 @@
         onRefreshOptions: function (options) {
             return false;
         },
+        onRefresh: function (params) {
+          return false;
+        },
         onResetView: function () {
             return false;
         }
@@ -564,7 +567,8 @@
         'expand-row.bs.table': 'onExpandRow',
         'collapse-row.bs.table': 'onCollapseRow',
         'refresh-options.bs.table': 'onRefreshOptions',
-        'reset-view.bs.table': 'onResetView'
+        'reset-view.bs.table': 'onResetView',
+        'refresh.bs.table': 'onRefresh'
     };
 
     BootstrapTable.prototype.init = function () {
@@ -2677,6 +2681,7 @@
             this.options.pageNumber = 1;
         }
         this.initServer(params && params.silent, params && params.query);
+        this.trigger('refresh', params);
     };
 
     BootstrapTable.prototype.resetWidth = function () {