Browse Source

Fix #3452: reset the table data when url loaded error

zhixin 8 years ago
parent
commit
6ff3b65ff0
1 changed files with 7 additions and 0 deletions
  1. 7 0
      src/bootstrap-table.js

+ 7 - 0
src/bootstrap-table.js

@@ -2079,6 +2079,13 @@
                 if (!silent) that.$tableLoading.hide();
                 if (!silent) that.$tableLoading.hide();
             },
             },
             error: function (res) {
             error: function (res) {
+                var data = [];
+                if (this.options.sidePagination === 'server') {
+                    data = {};
+                    data[this.options.totalField] = 0;
+                    data[this.options.dataField] = [];
+                }
+                that.load(data);
                 that.trigger('load-error', res.status, res);
                 that.trigger('load-error', res.status, res);
                 if (!silent) that.$tableLoading.hide();
                 if (!silent) that.$tableLoading.hide();
             }
             }