浏览代码

Fix #112: update the 'refresh' method.

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

+ 9 - 5
src/bootstrap-table.js

@@ -923,7 +923,7 @@
         this.resetView();
         this.resetView();
     };
     };
 
 
-    BootstrapTable.prototype.initServer = function () {
+    BootstrapTable.prototype.initServer = function (silent) {
         var that = this,
         var that = this,
             data = {},
             data = {},
             params = {
             params = {
@@ -937,7 +937,9 @@
         if (!this.options.url) {
         if (!this.options.url) {
             return;
             return;
         }
         }
-        this.$loading.show();
+        if (!silent) {
+            this.$loading.show();
+        }
 
 
         if (this.options.queryParamsType === 'limit') {
         if (this.options.queryParamsType === 'limit') {
             params = {
             params = {
@@ -981,7 +983,9 @@
                 that.trigger('load-error', res.status);
                 that.trigger('load-error', res.status);
             },
             },
             complete: function () {
             complete: function () {
-                that.$loading.hide();
+                if (!silent) {
+                    that.$loading.hide();
+                }
             }
             }
         });
         });
     };
     };
@@ -1245,8 +1249,8 @@
         this.$loading.hide();
         this.$loading.hide();
     };
     };
 
 
-    BootstrapTable.prototype.refresh = function () {
-        this.initServer();
+    BootstrapTable.prototype.refresh = function (params) {
+        this.initServer(params && params.silent);
     };
     };
 
 
     BootstrapTable.prototype.showColumn = function (field) {
     BootstrapTable.prototype.showColumn = function (field) {