Browse Source

Fix/4582 (#4590)

* Updated .npmignore

* Added jqXHR parameter for responseHandler option and onLoadSuccess event
文翼 6 years ago
parent
commit
0d2612280e
4 changed files with 21 additions and 4 deletions
  1. 15 1
      .npmignore
  2. 2 0
      site/docs/api/events.md
  3. 1 0
      site/docs/api/table-options.md
  4. 3 3
      src/bootstrap-table.js

+ 15 - 1
.npmignore

@@ -1,2 +1,16 @@
-tools
+_gh_pages
+.github
+.sass-cache
 site
+tools
+_config.yml
+.browserslistrc
+.eslintrc.js
+.stylelintrc
+.travis.yml
+CONTRIBUTING.md
+deploy_key.enc
+deploy.sh
+DONATORS.md
+Gemfile
+Gemfile.lock

+ 2 - 0
site/docs/api/events.md

@@ -191,6 +191,8 @@ $('#table').on('event-name.bs.table', function (e, arg1, arg2, ...) {
   Fires when remote data is loaded successfully, the parameters contain:
 
   * `data`: the remote data.
+  * `status`: the status code of `jqXHR` (from 1.15.5).
+  * `jqXHR`: jqXHR object, which is a superset of the XMLHTTPRequest object. For more information, see the [jqXHR Type](http://api.jquery.com/Types/#jqXHR) (from 1.15.5).
 
 ## onLoadError
 

+ 1 - 0
site/docs/api/table-options.md

@@ -471,6 +471,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
   Before load remote data, handler the response data format, the parameters object contains:
 
   * `res`: the response data.
+  * `jqXHR`: jqXHR object, which is a superset of the XMLHTTPRequest object. For more information, see the [jqXHR Type](http://api.jquery.com/Types/#jqXHR) (from 1.15.5).
 
 - **Default:** `function(res) { return res }`
 

+ 3 - 3
src/bootstrap-table.js

@@ -1612,12 +1612,12 @@ class BootstrapTable {
       cache: this.options.cache,
       contentType: this.options.contentType,
       dataType: this.options.dataType,
-      success: _res => {
+      success: (_res, textStatus, jqXHR) => {
         const res = Utils.calculateObjectValue(this.options,
-          this.options.responseHandler, [_res], _res)
+          this.options.responseHandler, [_res, jqXHR], _res)
 
         this.load(res)
-        this.trigger('load-success', res)
+        this.trigger('load-success', res, jqXHR.status, jqXHR)
         if (!silent) {
           this.hideLoading()
         }