ソースを参照

Add contentType and onBeforeLoad options.

zhixin 11 年 前
コミット
4864431d3d
1 ファイル変更6 行追加2 行削除
  1. 6 2
      src/bootstrap-table.js

+ 6 - 2
src/bootstrap-table.js

@@ -66,6 +66,7 @@
         data: [],
         method: 'get',
         url: undefined,
+        contentType: 'application/json',
         queryParams: function(pageSize, pageNumber, searchText) {return {};},
         pagination: false,
         sidePagination: 'client', // client or server
@@ -104,7 +105,8 @@
         onCheckAll: function() {return false;},
         onUncheckAll: function() {return false;},
         onLoadSuccess: function(data) {return false;},
-        onLoadError: function(status) {return false;}
+        onLoadError: function(status) {return false;},
+        onBeforeLoad: function(res) {return res;}
     };
 
     BootstrapTable.COLUMN_DEFAULTS = {
@@ -674,11 +676,13 @@
             type: this.options.method,
             url: this.options.url,
             data: data,
-            contentType: 'application/json',
+            contentType: this.options.contentType,
             dataType: 'json',
             success: function(res) {
                 var data = res;
 
+                res = that.options.onBeforeLoad(res);
+
                 if (that.options.sidePagination === 'server') {
                     that.options.totalRows = res.total;
                     data = res.rows;