浏览代码

Allow query params to be specified during refresh

When refreshing remote data, it may be required to optionally refresh with query params. Granted the data-query-params attribute is available, this function is not in the scope of the selected row, thus any row-specific data that might be used as a query param is not available.
Tristan Lee 11 年之前
父节点
当前提交
3fce799a49
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/bootstrap-table.js

+ 3 - 3
src/bootstrap-table.js

@@ -1142,7 +1142,7 @@
         this.trigger('post-body');
     };
 
-    BootstrapTable.prototype.initServer = function (silent) {
+    BootstrapTable.prototype.initServer = function (silent, queryparams) {
         var that = this,
             data = {},
             params = {
@@ -1166,7 +1166,7 @@
                 order: params.sortOrder
             };
         }
-        data = calculateObjectValue(this.options, this.options.queryParams, [params], data);
+        data = calculateObjectValue(this.options, $.extend(this.options.queryParams, queryparams || {}), [params], data);
 
         // false to stop request
         if (data === false) {
@@ -1493,7 +1493,7 @@
             this.options.url = params.url;
             this.options.pageNumber = 1;
         }
-        this.initServer(params && params.silent);
+        this.initServer(params && params.silent, params && params.queryparams);
     };
 
     BootstrapTable.prototype.showColumn = function (field) {