浏览代码

fix(js): fix #1959, sort column shows hidden rows in `server` side pagination

zhixin 7 年之前
父节点
当前提交
ed0d259056
共有 2 个文件被更改,包括 15 次插入2 次删除
  1. 4 0
      CHANGELOG.md
  2. 11 2
      src/bootstrap-table.js

+ 4 - 0
CHANGELOG.md

@@ -1,6 +1,10 @@
 ChangeLog
 ---------
 
+### 1.13.2
+
+- fix(js): fix #1959, sort column shows hidden rows in `server` side pagination
+
 ### 1.13.1
 
 - feat(js): add `theadClasses` option to supoort bootstrap v4

+ 11 - 2
src/bootstrap-table.js

@@ -256,6 +256,15 @@
     isIEBrowser () {
       return navigator.userAgent.includes('MSIE ') ||
         /Trident.*rv:11\./.test(navigator.userAgent)
+    },
+
+    findIndex (items, item) {
+      for (const [i, it] of items.entries()) {
+        if (JSON.stringify(it) === JSON.stringify(item)) {
+          return i
+        }
+      }
+      return -1
     }
   }
 
@@ -1639,7 +1648,7 @@
       let attributes = {}
       const htmlAttributes = []
 
-      if (this.hiddenRows.includes(item)) {
+      if (Utils.findIndex(this.hiddenRows, item) > -1) {
         return
       }
 
@@ -2646,7 +2655,7 @@
         return
       }
 
-      const index = this.hiddenRows.indexOf(row)
+      const index = Utils.findIndex(this.hiddenRows, row)
 
       if (!visible && index === -1) {
         this.hiddenRows.push(row)