浏览代码

Merge pull request #4399 from wenzhixin/fix/4002

go through the filtered data not through the whole data
文翼 6 年之前
父节点
当前提交
7fb1a6b163
共有 1 个文件被更改,包括 7 次插入4 次删除
  1. 7 4
      src/bootstrap-table.js

+ 7 - 4
src/bootstrap-table.js

@@ -528,7 +528,7 @@ class BootstrapTable {
         <button class="${this.constants.buttonsClass} dropdown-toggle" type="button" data-toggle="dropdown"
         <button class="${this.constants.buttonsClass} dropdown-toggle" type="button" data-toggle="dropdown"
         aria-label="Columns" title="${o.formatColumns()}">
         aria-label="Columns" title="${o.formatColumns()}">
         ${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.columns) : '' }
         ${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.columns) : '' }
-        ${o.showButtonText ? o.formatColumns() : ''} 
+        ${o.showButtonText ? o.formatColumns() : ''}
         ${this.constants.html.dropdownCaret}
         ${this.constants.html.dropdownCaret}
         </button>
         </button>
         ${this.constants.html.toolbarDropdown[0]}`)
         ${this.constants.html.toolbarDropdown[0]}`)
@@ -681,6 +681,10 @@ class BootstrapTable {
         $(currentTarget).val(text)
         $(currentTarget).val(text)
       }
       }
 
 
+      if (this.searchText === text) {
+        return
+      }
+
       this.searchText = text
       this.searchText = text
       this.options.searchText = text
       this.options.searchText = text
     }
     }
@@ -1952,12 +1956,11 @@ class BootstrapTable {
 
 
   getSelections () {
   getSelections () {
     // fix #2424: from html with checkbox
     // fix #2424: from html with checkbox
-    return this.options.data.filter(row =>
-      row[this.header.stateField] === true)
+    return this.data.filter(row => row[this.header.stateField] === true)
   }
   }
 
 
   getAllSelections () {
   getAllSelections () {
-    return this.options.data.filter(row => row[this.header.stateField])
+    return this.options.data.filter(row => row[this.header.stateField] === true)
   }
   }
 
 
   load (_data) {
   load (_data) {