浏览代码

added an option return the whole dataset without filtering via getData method (#4836)

Co-authored-by: Dennis Hernández <dennishernandezvargas@gmail.com>
Dustin Utecht 5 年之前
父节点
当前提交
a9f00e9c07
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 1 0
      site/docs/api/methods.md
  2. 7 5
      src/bootstrap-table.js

+ 1 - 0
site/docs/api/methods.md

@@ -38,6 +38,7 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
 
   * `useCurrentPage`: if set to true the method will return the data only in the current page.
   * `includeHiddenRows`: if set to true the method will include the hidden rows.
+  * `unfiltered`: if set to true the method will include all data (unfiltered).
 
 - **Example:** [Get Data](https://examples.bootstrap-table.com/#methods/getData.html)
 

+ 7 - 5
src/bootstrap-table.js

@@ -2034,11 +2034,13 @@ class BootstrapTable {
   getData (params) {
     let data = this.options.data
     if (
-      this.searchText ||
-      this.options.customSearch ||
-      this.options.sortName ||
-      !Utils.isEmptyObject(this.filterColumns) ||
-      !Utils.isEmptyObject(this.filterColumnsPartial)
+      (
+        this.searchText ||
+        this.options.customSearch ||
+        this.options.sortName ||
+        !Utils.isEmptyObject(this.filterColumns) ||
+        !Utils.isEmptyObject(this.filterColumnsPartial)
+      ) && (!params || !params.unfiltered)
     ) {
       data = this.data
     }