ソースを参照

Fix server side bug and update refresh params to query.

zhixin 11 年 前
コミット
7246dda352

+ 1 - 1
docs/_i18n/en/documentation/methods.md

@@ -69,7 +69,7 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter);`.
     <tr>
         <td>refresh</td>
         <td>params</td>
-        <td>Refresh the remote server data, you can set <code>{silent: true}</code> to refresh the data silently, and set <code>{url: newUrl}</code> to change the url. To supply query params specific to this request, set <code>{queryparams: {foo: 'bar'}}</code></td>
+        <td>Refresh the remote server data, you can set <code>{silent: true}</code> to refresh the data silently, and set <code>{url: newUrl}</code> to change the url. To supply query params specific to this request, set <code>{query: {foo: 'bar'}}</code></td>
     </tr>
     <tr>
         <td>showLoading</td>

+ 1 - 1
docs/_i18n/fr/documentation/methods.md

@@ -69,7 +69,7 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter);`.
     <tr>
         <td>refresh</td>
         <td>params</td>
-        <td>Refresh the remote server data, you can set <code>{silent: true}</code> to refresh the data silently, and set <code>{url: newUrl}</code> to change the url. To supply query params specific to this request, set <code>{queryparams: {foo: 'bar'}}</code></td>
+        <td>Refresh the remote server data, you can set <code>{silent: true}</code> to refresh the data silently, and set <code>{url: newUrl}</code> to change the url. To supply query params specific to this request, set <code>{query: {foo: 'bar'}}</code></td>
     </tr>
     <tr>
         <td>showLoading</td>

+ 1 - 1
docs/_i18n/zh-cn/documentation/methods.md

@@ -69,7 +69,7 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter);`.
     <tr>
         <td>refresh</td>
         <td>params</td>
-        <td>Refresh the remote server data, you can set <code>{silent: true}</code> to refresh the data silently, and set <code>{url: newUrl}</code> to change the url. To supply query params specific to this request, set <code>{queryparams: {foo: 'bar'}}</code></td>
+        <td>Refresh the remote server data, you can set <code>{silent: true}</code> to refresh the data silently, and set <code>{url: newUrl}</code> to change the url. To supply query params specific to this request, set <code>{query: {foo: 'bar'}}</code></td>
     </tr>
     <tr>
         <td>showLoading</td>

+ 7 - 3
src/bootstrap-table.js

@@ -934,6 +934,8 @@
             this.$body = $('<tbody></tbody>').appendTo(this.$el);
         }
 
+		//Fix #389 Bootstrap-table-flatJSON is not working
+
         if (!this.options.pagination || this.options.sidePagination === 'server') {
             this.pageFrom = 1;
             this.pageTo = data.length;
@@ -1144,7 +1146,7 @@
         this.trigger('post-body');
     };
 
-    BootstrapTable.prototype.initServer = function (silent, queryparams) {
+    BootstrapTable.prototype.initServer = function (silent, query) {
         var that = this,
             data = {},
             params = {
@@ -1168,7 +1170,9 @@
                 order: params.sortOrder
             };
         }
-        data = calculateObjectValue(this.options, $.extend(this.options.queryParams, queryparams || {}), [params], data);
+        data = calculateObjectValue(this.options, this.options.queryParams, [params], data);
+
+        $.extend(data, query || {});
 
         // false to stop request
         if (data === false) {
@@ -1495,7 +1499,7 @@
             this.options.url = params.url;
             this.options.pageNumber = 1;
         }
-        this.initServer(params && params.silent, params && params.queryparams);
+        this.initServer(params && params.silent, params && params.query);
     };
 
     BootstrapTable.prototype.showColumn = function (field) {